Sfoglia il codice sorgente

Fixed front & Added transfer key validation middleware

Taichi Masuyama 3 anni fa
parent
commit
f7c805ba6e

+ 1 - 1
packages/app/src/components/Admin/G2GDataTransfer.tsx

@@ -98,7 +98,7 @@ const G2GDataTransfer = (): JSX.Element => {
     try {
       await customAxios.post('/_api/v3/g2g-transfer/transfer', {
         transferKey: startTransferKey,
-        collections: selectedCollections,
+        collections: Array.from(selectedCollections),
         optionsMap,
       });
     }

+ 1 - 2
packages/app/src/server/routes/apiv3/g2g-transfer.ts

@@ -242,9 +242,8 @@ module.exports = (crowi: Crowi): Router => {
     return res.apiv3({ message: 'Successfully started to receive transfer data.' });
   });
 
-  // TODO: verify transfer key
   // This endpoint uses multer's MemoryStorage since the received data should be persisted directly on attachment storage.
-  receiveRouter.post('/attachment', uploadsForAttachment.single('content'), /* verifyAndExtractTransferKey, */
+  receiveRouter.post('/attachment', uploadsForAttachment.single('content'), verifyAndExtractTransferKey,
     async(req: Request & { transferKey: TransferKey }, res: ApiV3Response) => {
       const { file } = req;
       const { attachmentMetadata } = req.body;