Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: ban emitFile via absolute paths on Windows OS (#3509)
Co-authored-by: Lukas Taegert-Atkinson <lukastaegert@users.noreply.github.com>
- Loading branch information
1 parent
0d352bf
commit bd2973a
Showing
3 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
test/function/samples/emit-file/invalid-asset-name3/_config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module.exports = { | ||
description: 'throws for invalid asset names with absolute path on Windows OS', | ||
options: { | ||
plugins: { | ||
name: 'test-plugin', | ||
buildStart() { | ||
this.emitFile({ type: 'asset', name: 'F:\\test.ext', source: 'content' }); | ||
} | ||
} | ||
}, | ||
error: { | ||
code: 'PLUGIN_ERROR', | ||
hook: 'buildStart', | ||
message: | ||
'The "fileName" or "name" properties of emitted files must be strings that are neither absolute nor relative paths and do not contain invalid characters, received "F:\\test.ext".', | ||
plugin: 'test-plugin', | ||
pluginCode: 'VALIDATION_ERROR' | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
throw new Error('should not build'); |