Skip to content

Commit 8e0833b

Browse files
committed
Add debug logging for sanitization
1 parent 9c98125 commit 8e0833b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/utils/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import typeByExt from '../config/resource-type-by-ext.js';
77

88
import logger from '../logger.js';
99

10+
1011
const MAX_FILENAME_LENGTH = 230;
1112
const IS_URL = /^((http[s]?:)?\/\/)/;
1213

@@ -99,7 +100,11 @@ function getFilenameExtension (filepath) {
99100
}
100101

101102
function sanitizeFilename (filename) {
102-
return filenamifySanitizeFilename(filename, {replacement: '_', maxLength: MAX_FILENAME_LENGTH});
103+
const sanitized = filenamifySanitizeFilename(filename, {replacement: '_', maxLength: MAX_FILENAME_LENGTH});
104+
if (sanitized !== filename) {
105+
logger.debug(`[utils] sanitize filename: ${filename} -> ${sanitized}`);
106+
}
107+
return sanitized;
103108
}
104109

105110
function normalizeUrl (u, opts) {

0 commit comments

Comments
 (0)