mirror of
https://github.com/sismics/docs.git
synced 2024-11-21 21:47:57 +01:00
Returns correct file variation from /file/id/data
This commit is contained in:
parent
d3f59554f8
commit
77c5a10aba
@ -41,7 +41,6 @@ import com.sismics.rest.exception.ClientException;
|
||||
import com.sismics.rest.exception.ForbiddenClientException;
|
||||
import com.sismics.rest.exception.ServerException;
|
||||
import com.sismics.rest.util.ValidationUtil;
|
||||
import com.sismics.util.ImageUtil;
|
||||
import com.sismics.util.mime.MimeTypeUtil;
|
||||
import com.sun.jersey.multipart.FormDataBodyPart;
|
||||
import com.sun.jersey.multipart.FormDataParam;
|
||||
@ -306,9 +305,8 @@ public class FileResource extends BaseResource {
|
||||
// Get the stored file
|
||||
java.io.File storedfile;
|
||||
if (size != null) {
|
||||
if (ImageUtil.isImage(file.getMimeType())) {
|
||||
storedfile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId + "_" + size).toFile();
|
||||
} else {
|
||||
storedfile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId + "_" + size).toFile();
|
||||
if (!storedfile.exists()) {
|
||||
storedfile = new java.io.File(getClass().getResource("/image/file.png").getFile());
|
||||
}
|
||||
} else {
|
||||
|
@ -416,6 +416,6 @@ public class TestDocumentResource extends BaseJerseyTest {
|
||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||
InputStream is = response.getEntityInputStream();
|
||||
byte[] fileBytes = ByteStreams.toByteArray(is);
|
||||
Assert.assertEquals(3457, fileBytes.length);
|
||||
Assert.assertEquals(33691, fileBytes.length);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user