multermate 1.0.1 → 1.0.2
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/index.js +5 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -37,7 +37,11 @@ const configureStorage = (destination) => {
|
|
|
37
37
|
const extension = path.extname(sanitizedFilename);
|
|
38
38
|
const fieldName = file.fieldname || "file"; // Use the field name as part of the filename.
|
|
39
39
|
const uniqueName = uuidv4(); // Generate a unique name using uuid.
|
|
40
|
-
|
|
40
|
+
let fileName = `${uniqueName}-${fieldName}${extension}`;
|
|
41
|
+
|
|
42
|
+
// Replace backslashes with forward slashes in the final filename
|
|
43
|
+
fileName = fileName.replace(/\\/g, "/");
|
|
44
|
+
|
|
41
45
|
cb(null, fileName); // Set the final filename.
|
|
42
46
|
},
|
|
43
47
|
});
|