Explorar o código

imprv: set content length in response header of attachment route

hiroki-h %!s(int64=4) %!d(string=hai) anos
pai
achega
c23499ad51
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  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({
       ETag: `Attachment-${attachment._id}`,
       'Last-Modified': attachment.createdAt.toUTCString(),
-      'Content-Length': attachment.fileSize,
     });
 
+    if (!attachment.fileSize) {
+      res.set({
+        'Content-Length': attachment.fileSize,
+      });
+    }
+
     // download
     if (forceDownload) {
       res.set({