Skip to content

Commit

Permalink
Trigger antivirus checks on document updates
Browse files Browse the repository at this point in the history
  • Loading branch information
car031 committed Jun 8, 2023
1 parent ac133cf commit bcabe9f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public void checkin(long docId, File file, String filename, boolean release, Abs
throw new IllegalArgumentException("File name is mandatory");

transaction.setEvent(DocumentEvent.CHECKEDIN.toString());
transaction.setFile(file.getAbsolutePath());

/*
* Better to synchronize this block because under high multi-threading
Expand Down Expand Up @@ -349,7 +350,7 @@ public void checkin(long docId, InputStream content, String filename, boolean re
validateTransaction(transaction);

// Write content to temporary file, then delete it
File tmp = FileUtil.createTempFile("checkin", "");
File tmp = FileUtil.createTempFile("checkin", "." + FileUtil.getExtension(filename));
try {
FileUtil.writeFile(content, tmp.getPath());
checkin(docId, tmp, filename, release, docVO, transaction);
Expand Down Expand Up @@ -458,7 +459,8 @@ public String parseDocument(Document doc, String fileVersion) throws ParseExcept

TenantDAO tDao = (TenantDAO) Context.get().getBean(TenantDAO.class);
try {
content = parser.parse(storer.getStream(doc.getId(), resource), new ParseParameters(doc, doc.getFileName(), fileVersion, null, locale, tDao.findById(doc.getTenantId()).getName()));
content = parser.parse(storer.getStream(doc.getId(), resource), new ParseParameters(doc,
doc.getFileName(), fileVersion, null, locale, tDao.findById(doc.getTenantId()).getName()));
} catch (Exception e) {
log.error("Cannot parse document {}", doc, e);
if (e instanceof ParseException)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ protected void service(HttpServletRequest request, HttpServletResponse response,
writer.print(ENTRY_CLOSE);
}

DocumentDAO dao = (DocumentDAO) Context.get().getBean("DocumentDAO");
DocumentDAO dao = (DocumentDAO) Context.get().getBean(DocumentDAO.class);
Map<String, String> meta = dao.getDatabaseMetadata();
for (Map.Entry<String, String> entry : meta.entrySet()) {
writer.print(ENTRY_SCOPE_DATABASE_SCOPE);
Expand Down

0 comments on commit bcabe9f

Please sign in to comment.