Explorar el Código

imprv: set content length in response header of attachment route

hiroki-h hace 3 años
padre
commit
c23499ad51
Se han modificado 1 ficheros con 6 adiciones y 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({