Merge branch 'DaCoolMoreLikeDaDumb' into 'master'
Use the correct "can write" check See merge request sheepitrenderfarm/client!134
This commit is contained in:
@@ -27,6 +27,7 @@ import java.io.OutputStream;
|
|||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.io.StringWriter;
|
import java.io.StringWriter;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.net.*;
|
import java.net.*;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -501,17 +502,16 @@ public class Server extends Thread {
|
|||||||
this.log.debug(String.format("File downloaded at %s/s, written %d bytes", new TransferStats(size, duration.getSeconds() + 1).getAverageSessionSpeed(), written));
|
this.log.debug(String.format("File downloaded at %s/s, written %d bytes", new TransferStats(size, duration.getSeconds() + 1).getAverageSessionSpeed(), written));
|
||||||
|
|
||||||
this.lastRequestTime = new Date().getTime();
|
this.lastRequestTime = new Date().getTime();
|
||||||
|
|
||||||
return Error.Type.OK;
|
return Error.Type.OK;
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
File destFile = new File(destination_);
|
File destFile = new File(destination_);
|
||||||
if (destFile.getParentFile().isDirectory() == false) {
|
if (Files.isWritable(destFile.getParentFile().toPath()) == false) {
|
||||||
throw new FermeExceptionPathInvalid();
|
|
||||||
}
|
|
||||||
else if (destFile.canWrite() == false) {
|
|
||||||
throw new FermeExceptionNoWritePermission();
|
throw new FermeExceptionNoWritePermission();
|
||||||
}
|
}
|
||||||
|
else if (destFile.getParentFile().isDirectory() == false) {
|
||||||
|
throw new FermeExceptionPathInvalid();
|
||||||
|
}
|
||||||
else if (Utils.noFreeSpaceOnDisk(destFile.getParent(), log)) {
|
else if (Utils.noFreeSpaceOnDisk(destFile.getParent(), log)) {
|
||||||
throw new FermeExceptionNoSpaceLeftOnDevice();
|
throw new FermeExceptionNoSpaceLeftOnDevice();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user