mirror of
https://github.com/sismics/docs.git
synced 2024-11-22 14:07:55 +01:00
Fix default thumbnail
This commit is contained in:
parent
db7a9f0e4a
commit
4e22111f38
@ -336,6 +336,7 @@ public class FileResource extends BaseResource {
|
|||||||
if (!storedfile.exists()) {
|
if (!storedfile.exists()) {
|
||||||
storedfile = new java.io.File(getClass().getResource("/image/file.png").getFile());
|
storedfile = new java.io.File(getClass().getResource("/image/file.png").getFile());
|
||||||
mimeType = MimeType.IMAGE_PNG;
|
mimeType = MimeType.IMAGE_PNG;
|
||||||
|
decrypt = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
storedfile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId).toFile();
|
storedfile = Paths.get(DirectoryUtil.getStorageDirectory().getPath(), fileId).toFile();
|
||||||
|
@ -18,6 +18,8 @@ import org.junit.Test;
|
|||||||
import com.google.common.io.ByteStreams;
|
import com.google.common.io.ByteStreams;
|
||||||
import com.sismics.docs.core.util.DirectoryUtil;
|
import com.sismics.docs.core.util.DirectoryUtil;
|
||||||
import com.sismics.docs.rest.filter.CookieAuthenticationFilter;
|
import com.sismics.docs.rest.filter.CookieAuthenticationFilter;
|
||||||
|
import com.sismics.util.mime.MimeType;
|
||||||
|
import com.sismics.util.mime.MimeTypeUtil;
|
||||||
import com.sun.jersey.api.client.ClientResponse;
|
import com.sun.jersey.api.client.ClientResponse;
|
||||||
import com.sun.jersey.api.client.ClientResponse.Status;
|
import com.sun.jersey.api.client.ClientResponse.Status;
|
||||||
import com.sun.jersey.api.client.WebResource;
|
import com.sun.jersey.api.client.WebResource;
|
||||||
@ -296,6 +298,7 @@ public class TestDocumentResource extends BaseJerseyTest {
|
|||||||
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
Assert.assertEquals(Status.OK, Status.fromStatusCode(response.getStatus()));
|
||||||
InputStream is = response.getEntityInputStream();
|
InputStream is = response.getEntityInputStream();
|
||||||
byte[] fileBytes = ByteStreams.toByteArray(is);
|
byte[] fileBytes = ByteStreams.toByteArray(is);
|
||||||
|
Assert.assertEquals(MimeType.IMAGE_JPEG, MimeTypeUtil.guessMimeType(fileBytes));
|
||||||
Assert.assertEquals(33691, fileBytes.length);
|
Assert.assertEquals(33691, fileBytes.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user