1
0
mirror of https://github.com/sismics/docs.git synced 2025-12-14 10:16:21 +00:00

#182: fix thumbnail for orphan files

This commit is contained in:
Benjamin Gamard
2018-03-14 18:12:19 +01:00
parent 2a619849f4
commit 94e18146fd
3 changed files with 34 additions and 17 deletions

View File

@@ -96,10 +96,12 @@ public class FileCreatedAsyncListener {
fileDao.update(file);
}
});
// Update Lucene index
LuceneDao luceneDao = new LuceneDao();
luceneDao.createFile(event.getFile());
if (file.getDocumentId() != null) {
// Update Lucene index
LuceneDao luceneDao = new LuceneDao();
luceneDao.createFile(event.getFile());
}
FileUtil.endProcessingFile(file.getId());
}

View File

@@ -60,7 +60,10 @@ public class FileUtil {
*/
public static String extractContent(String language, File file, Path unencryptedFile, Path unencryptedPdfFile) {
String content = null;
if (language == null) {
return null;
}
if (ImageUtil.isImage(file.getMimeType())) {
content = ocrFile(unencryptedFile, language);
} else if (VideoUtil.isVideo(file.getMimeType())) {
@@ -251,15 +254,15 @@ public class FileUtil {
userDao.updateQuota(user);
// Raise a new file created event and document updated event if we have a document
if (documentId != null) {
startProcessingFile(fileId);
FileCreatedAsyncEvent fileCreatedAsyncEvent = new FileCreatedAsyncEvent();
fileCreatedAsyncEvent.setUserId(userId);
fileCreatedAsyncEvent.setLanguage(language);
fileCreatedAsyncEvent.setFile(file);
fileCreatedAsyncEvent.setUnencryptedFile(unencryptedFile);
ThreadLocalContext.get().addAsyncEvent(fileCreatedAsyncEvent);
startProcessingFile(fileId);
FileCreatedAsyncEvent fileCreatedAsyncEvent = new FileCreatedAsyncEvent();
fileCreatedAsyncEvent.setUserId(userId);
fileCreatedAsyncEvent.setLanguage(language);
fileCreatedAsyncEvent.setFile(file);
fileCreatedAsyncEvent.setUnencryptedFile(unencryptedFile);
ThreadLocalContext.get().addAsyncEvent(fileCreatedAsyncEvent);
if (documentId != null) {
DocumentUpdatedAsyncEvent documentUpdatedAsyncEvent = new DocumentUpdatedAsyncEvent();
documentUpdatedAsyncEvent.setUserId(userId);
documentUpdatedAsyncEvent.setDocumentId(documentId);