The minimalistic document archiving platform.
chore(deps): update dependency filenamify to v7.0.3 (#1238)
renovate[bot]0829399dd645
diff --git a/apps/papra-server/src/modules/documents/documents.models.test.ts b/apps/papra-server/src/modules/documents/documents.models.test.tsindex 3c504e6b..02d72615 100644--- a/apps/papra-server/src/modules/documents/documents.models.test.ts+++ b/apps/papra-server/src/modules/documents/documents.models.test.ts@@ -148,7 +148,7 @@ describe('documents models', () => {expect(ensureSafeFileName('.file.txt.')).to.eql('.file.txt');});- test('reserved file names on Windows are suffixed with an underscore', () => {+ test('reserved file names on Windows get an underscore before any extension', () => {const reservedFileNames = ['con','prn',@@ -167,13 +167,22 @@ describe('documents models', () => {expect(ensureSafeFileName(upper)).to.eql(`${upper}_`);expect(ensureSafeFileName(title)).to.eql(`${title}_`);- // Ok with extensions- expect(ensureSafeFileName(`${lower}.txt`)).to.eql(`${lower}.txt`);- expect(ensureSafeFileName(`${upper}.txt`)).to.eql(`${upper}.txt`);- expect(ensureSafeFileName(`${title}.txt`)).to.eql(`${title}.txt`);+ // Windows reserves these names even when followed by one or more extensions.+ for (const extension of ['.txt', '.tar.gz']) {+ expect(ensureSafeFileName(`${lower}${extension}`)).to.eql(`${lower}_${extension}`);+ expect(ensureSafeFileName(`${upper}${extension}`)).to.eql(`${upper}_${extension}`);+ expect(ensureSafeFileName(`${title}${extension}`)).to.eql(`${title}_${extension}`);+ }}});+ test('file names that only start with a Windows reserved name are preserved', () => {+ expect(ensureSafeFileName('console.txt')).to.eql('console.txt');+ expect(ensureSafeFileName('auxiliary.txt')).to.eql('auxiliary.txt');+ expect(ensureSafeFileName('com10.txt')).to.eql('com10.txt');+ expect(ensureSafeFileName('lpt10.txt')).to.eql('lpt10.txt');+ });+test('path separators are replaced with underscores to prevent directory traversal', () => {expect(ensureSafeFileName('../file.txt')).to.eql('_file.txt');expect(ensureSafeFileName('..\\file.txt')).to.eql('_file.txt');diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 4bd75e36..7cd17e33 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -524,7 +524,7 @@ importers:version: 21.3.4([email protected])filenamify:specifier: ^7.0.1- version: 7.0.1+ version: 7.0.3hono:specifier: ^4.12.18version: 4.13.5@@ -6952,10 +6952,18 @@ packages:resolution: {integrity: sha512-9ZT504KxEQDamsOogZImAWGEN24R1uFAxU3ZS4AZqn2ooidmN68Olh7n4/RcA4lLatZztjA0ZSuxeLHVoCc8JA==}engines: {node: '>=20'}+ resolution: {integrity: sha512-qUet2faQFKvtvVUsEf7wCrTURwxBOIZpspsLHGifw9QCWk55ITE2FrG8XhfQqG/uxMA1xEGFVQbL+Yfm0O94+Q==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-9b4rfnaX2MkJCgp27wypV6DAMvj4WMOSgJ+TdcpJIO84Dql+Cv6iJjdG4XDTLubOWkfNiBv3joO59sau/TXw+Q==}engines: {node: '>=20'}+ resolution: {integrity: sha512-Pf0dwHrWs1GcIK15ps304fmxp2AOcfNR6vOIMvCPEy6ZztKYxzRQHlOuPVWo2HRjbCLHaRTY+kD8n3RbQ0A/fw==}+ engines: {node: '>=20'}+resolution: {integrity: sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==}engines: {node: '>=8'}@@ -19264,10 +19272,16 @@ snapshots:+ [email protected]: {}+dependencies:filename-reserved-regex: 4.0.0+ dependencies:+ filename-reserved-regex: 4.0.1+dependencies:to-regex-range: 5.0.1