Przeglądaj źródła

imprv: set content length in response header of attachment route

hiroki-h 3 lat temu
rodzic
commit
c23499ad51
1 zmienionych plików z 6 dodań i 1 usunięć
  1. 6 1
      packages/app/src/server/routes/attachment.js

+ 6 - 1
packages/app/src/server/routes/attachment.js

@@ -228,9 +228,14 @@ module.exports = function(crowi, app) {
     res.set({
     res.set({
       ETag: `Attachment-${attachment._id}`,
       ETag: `Attachment-${attachment._id}`,
       'Last-Modified': attachment.createdAt.toUTCString(),
       'Last-Modified': attachment.createdAt.toUTCString(),
-      'Content-Length': attachment.fileSize,
     });
     });
 
 
+    if (!attachment.fileSize) {
+      res.set({
+        'Content-Length': attachment.fileSize,
+      });
+    }
+
     // download
     // download
     if (forceDownload) {
     if (forceDownload) {
       res.set({
       res.set({