@muhgholy/next-drive 4.23.11 → 4.23.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-26KZWPCF.js → chunk-P5U4E6MG.js} +10 -15
- package/dist/chunk-P5U4E6MG.js.map +1 -0
- package/dist/{chunk-NDHVF2IB.cjs → chunk-SDOFFTZ5.cjs} +10 -15
- package/dist/chunk-SDOFFTZ5.cjs.map +1 -0
- package/dist/client/hooks/use-upload.d.ts +1 -1
- package/dist/client/hooks/use-upload.d.ts.map +1 -1
- package/dist/client/index.cjs +2 -3
- package/dist/client/index.cjs.map +1 -1
- package/dist/client/index.js +2 -3
- package/dist/client/index.js.map +1 -1
- package/dist/server/actions/drive.d.ts.map +1 -1
- package/dist/server/express.cjs +11 -11
- package/dist/server/express.js +2 -2
- package/dist/server/hono.cjs +11 -11
- package/dist/server/hono.js +2 -2
- package/dist/server/index.cjs +18 -18
- package/dist/server/index.js +1 -1
- package/dist/server/zod/schemas.d.ts +0 -5
- package/dist/server/zod/schemas.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-26KZWPCF.js.map +0 -1
- package/dist/chunk-NDHVF2IB.cjs.map +0 -1
|
@@ -1533,8 +1533,7 @@ var uploadChunkSchema = z.object({
|
|
|
1533
1533
|
fileName: nameSchema,
|
|
1534
1534
|
fileSize: z.number().int().min(0).max(Number.MAX_SAFE_INTEGER),
|
|
1535
1535
|
fileType: z.string().min(1).max(255),
|
|
1536
|
-
folderId: z.string().optional()
|
|
1537
|
-
unauthenticated: z.coerce.boolean().optional()
|
|
1536
|
+
folderId: z.string().optional()
|
|
1538
1537
|
}).refine((data) => data.chunkIndex < data.totalChunks, {
|
|
1539
1538
|
message: "Chunk index must be less than total chunks"
|
|
1540
1539
|
});
|
|
@@ -2262,16 +2261,16 @@ var handleDriveAction = async (ctx) => {
|
|
|
2262
2261
|
cleanupTempFiles(files);
|
|
2263
2262
|
return void res.status(400).json({ status: 400, message: uploadData.error.errors[0].message });
|
|
2264
2263
|
}
|
|
2265
|
-
const { chunkIndex, totalChunks, driveId, fileName, fileSize: fileSizeInBytes, fileType, folderId
|
|
2264
|
+
const { chunkIndex, totalChunks, driveId, fileName, fileSize: fileSizeInBytes, fileType, folderId } = uploadData.data;
|
|
2266
2265
|
let currentUploadId = driveId;
|
|
2267
2266
|
const tempBaseDir = path.join(os2.tmpdir(), "next-drive-uploads");
|
|
2268
2267
|
if (!currentUploadId) {
|
|
2269
2268
|
if (chunkIndex !== 0) return void res.status(400).json({ message: "Could not upload: missing upload session for this chunk" });
|
|
2270
|
-
if (
|
|
2269
|
+
if (!authenticated) {
|
|
2271
2270
|
const unauth = config.security?.unauthenticated;
|
|
2272
2271
|
if (!unauth?.enabled) {
|
|
2273
2272
|
cleanupTempFiles(files);
|
|
2274
|
-
return void res.status(
|
|
2273
|
+
return void res.status(401).json({ status: 401, message: "Authentication required to upload" });
|
|
2275
2274
|
}
|
|
2276
2275
|
if (fileSizeInBytes > unauth.maxUploadSizeInBytes) {
|
|
2277
2276
|
cleanupTempFiles(files);
|
|
@@ -2312,10 +2311,6 @@ var handleDriveAction = async (ctx) => {
|
|
|
2312
2311
|
store.concurrent++;
|
|
2313
2312
|
}
|
|
2314
2313
|
} else {
|
|
2315
|
-
if (!authenticated) {
|
|
2316
|
-
cleanupTempFiles(files);
|
|
2317
|
-
return void res.status(401).json({ status: 401, message: "Authentication required to upload" });
|
|
2318
|
-
}
|
|
2319
2314
|
if (fileType && config.security) {
|
|
2320
2315
|
if (!validateMimeType(fileType, config.security.allowedMimeTypes)) {
|
|
2321
2316
|
cleanupTempFiles(files);
|
|
@@ -2334,15 +2329,15 @@ var handleDriveAction = async (ctx) => {
|
|
|
2334
2329
|
const uploadDir2 = path.join(tempBaseDir, currentUploadId);
|
|
2335
2330
|
fs.mkdirSync(uploadDir2, { recursive: true });
|
|
2336
2331
|
const metadata = {
|
|
2337
|
-
owner:
|
|
2338
|
-
accountId:
|
|
2332
|
+
owner: authenticated ? owner : null,
|
|
2333
|
+
accountId: authenticated ? accountId : null,
|
|
2339
2334
|
providerName: provider.name,
|
|
2340
2335
|
name: fileName,
|
|
2341
|
-
parentId:
|
|
2336
|
+
parentId: !authenticated || folderId === "root" || !folderId ? null : folderId,
|
|
2342
2337
|
fileSize: fileSizeInBytes,
|
|
2343
2338
|
mimeType: fileType,
|
|
2344
2339
|
totalChunks,
|
|
2345
|
-
unauthenticated:
|
|
2340
|
+
unauthenticated: !authenticated
|
|
2346
2341
|
};
|
|
2347
2342
|
fs.writeFileSync(path.join(uploadDir2, "metadata.json"), JSON.stringify(metadata));
|
|
2348
2343
|
}
|
|
@@ -2738,5 +2733,5 @@ var driveAPIHandler = async (req, res) => {
|
|
|
2738
2733
|
};
|
|
2739
2734
|
|
|
2740
2735
|
export { driveAPIHandler, driveCleanup, driveConfiguration, driveConfirm, driveDelete, driveFilePath, driveFileSchemaZod, driveGetUrl, driveInfo, driveList, driveListFiles, drivePurgeExpired, driveReadFile, driveUpload, drive_default, getDriveConfig, getDriveInformation };
|
|
2741
|
-
//# sourceMappingURL=chunk-
|
|
2742
|
-
//# sourceMappingURL=chunk-
|
|
2736
|
+
//# sourceMappingURL=chunk-P5U4E6MG.js.map
|
|
2737
|
+
//# sourceMappingURL=chunk-P5U4E6MG.js.map
|