浏览代码

companion: send content-length for oneDrive domain verification

ifedapoolarewaju 5 年之前
父节点
当前提交
5581ad6141
共有 1 个文件被更改,包括 7 次插入9 次删除
  1. 7 9
      packages/@uppy/companion/src/standalone/index.js

+ 7 - 9
packages/@uppy/companion/src/standalone/index.js

@@ -160,18 +160,16 @@ if (process.env.COMPANION_PATH) {
 // please do not set a value for COMPANION_ONEDRIVE_DOMAIN_VALIDATION
 // please do not set a value for COMPANION_ONEDRIVE_DOMAIN_VALIDATION
 if (process.env.COMPANION_ONEDRIVE_DOMAIN_VALIDATION === 'true' && process.env.COMPANION_ONEDRIVE_KEY) {
 if (process.env.COMPANION_ONEDRIVE_DOMAIN_VALIDATION === 'true' && process.env.COMPANION_ONEDRIVE_KEY) {
   app.get('/.well-known/microsoft-identity-association.json', (req, res) => {
   app.get('/.well-known/microsoft-identity-association.json', (req, res) => {
+    const content = JSON.stringify({
+      associatedApplications: [
+        { applicationId: process.env.COMPANION_ONEDRIVE_KEY }
+      ]
+    })
+    res.header('Content-Length', `${content.length}`)
     // use writeHead to prevent 'charset' from being appended
     // use writeHead to prevent 'charset' from being appended
     // https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-configure-publisher-domain#to-select-a-verified-domain
     // https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-configure-publisher-domain#to-select-a-verified-domain
     res.writeHead(200, { 'Content-Type': 'application/json' })
     res.writeHead(200, { 'Content-Type': 'application/json' })
-    res.end(JSON.stringify(
-      {
-        associatedApplications: [
-          {
-            applicationId: process.env.COMPANION_ONEDRIVE_KEY
-          }
-        ]
-      })
-    )
+    res.end(content)
   })
   })
 }
 }