Yuki Takei 1 год назад
Родитель
Сommit
2d916942a4

+ 2 - 0
apps/app/package.json

@@ -228,6 +228,7 @@
     "unzip-stream": "^0.3.2",
     "url-join": "^4.0.0",
     "usehooks-ts": "^2.6.0",
+    "uuid": "^11.0.3",
     "validator": "^13.7.0",
     "ws": "^8.17.1",
     "xss": "^1.0.15",
@@ -272,6 +273,7 @@
     "@types/unist": "^3.0.3",
     "@types/unzip-stream": "^0.3.4",
     "@types/url-join": "^4.0.2",
+    "@types/uuid": "^10.0.0",
     "babel-loader": "^8.2.5",
     "bootstrap": "=5.3.2",
     "connect-browser-sync": "^2.1.0",

+ 2 - 2
apps/app/src/server/service/file-uploader/file-uploader.ts

@@ -1,7 +1,7 @@
-import { randomUUID } from 'crypto';
 import type { ReadStream } from 'fs';
 
 import type { Response } from 'express';
+import { v4 as uuidv4 } from 'uuid';
 
 import type { ICheckLimitResult } from '~/interfaces/attachment';
 import { type RespondOptions, ResponseMode } from '~/server/interfaces/attachment';
@@ -60,7 +60,7 @@ export abstract class AbstractFileUploader implements FileUploader {
    * @returns Whether write opration to the storage is permitted
    */
   async isWritable() {
-    const filePath = `${randomUUID()}.growi`;
+    const filePath = `${uuidv4()}.growi`;
     const data = 'This file was created during g2g transfer to check write permission. You can safely remove this file.';
 
     try {

+ 18 - 1
pnpm-lock.yaml

@@ -687,6 +687,9 @@ importers:
       usehooks-ts:
         specifier: ^2.6.0
         version: 2.16.0(react@18.2.0)
+      uuid:
+        specifier: ^11.0.3
+        version: 11.0.3
       validator:
         specifier: ^13.7.0
         version: 13.12.0
@@ -796,6 +799,9 @@ importers:
       '@types/url-join':
         specifier: ^4.0.2
         version: 4.0.3
+      '@types/uuid':
+        specifier: ^10.0.0
+        version: 10.0.0
       babel-loader:
         specifier: ^8.2.5
         version: 8.3.0(@babel/core@7.24.6)(webpack@5.92.1(@swc/core@1.5.25(@swc/helpers@0.5.11)))
@@ -4164,6 +4170,9 @@ packages:
   '@types/url-join@4.0.3':
     resolution: {integrity: sha512-3l1qMm3wqO0iyC5gkADzT95UVW7C/XXcdvUcShOideKF0ddgVRErEQQJXBd2kvQm+aSgqhBGHGB38TgMeT57Ww==}
 
+  '@types/uuid@10.0.0':
+    resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==}
+
   '@types/warning@3.0.3':
     resolution: {integrity: sha512-D1XC7WK8K+zZEveUPY+cf4+kgauk8N4eHr/XIHXGlGYkHLud6hK9lYfZk1ry1TNh798cZUCgb6MqGEG8DkJt6Q==}
 
@@ -11699,6 +11708,10 @@ packages:
     resolution: {integrity: sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==}
     engines: {node: '>= 0.4.0'}
 
+  uuid@11.0.3:
+    resolution: {integrity: sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg==}
+    hasBin: true
+
   uuid@3.3.2:
     resolution: {integrity: sha512-yXJmeNaw3DnnKAOKJE51sL/ZaYfWJRl1pK9dr19YFCu0ObS231AB1/LbqTKRAQ5kw8A90rA6fr4riOUpTZvQZA==}
     deprecated: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
@@ -14652,7 +14665,7 @@ snapshots:
       statuses: 2.0.1
       string-template: 1.0.0
       striptags: 3.2.0
-      uuid: 9.0.1
+      uuid: 11.0.3
 
   '@lykmapipo/env@0.17.8':
     dependencies:
@@ -16276,6 +16289,8 @@ snapshots:
 
   '@types/url-join@4.0.3': {}
 
+  '@types/uuid@10.0.0': {}
+
   '@types/warning@3.0.3': {}
 
   '@types/webidl-conversions@6.1.1': {}
@@ -25387,6 +25402,8 @@ snapshots:
 
   utils-merge@1.0.1: {}
 
+  uuid@11.0.3: {}
+
   uuid@3.3.2: {}
 
   uuid@3.4.0: {}