mirror of
https://github.com/foambubble/foam.git
synced 2026-01-09 14:08:13 -05:00
Unsanitize characters permissible in Windows paths (#1533)
This commit is contained in:
@@ -499,8 +499,8 @@ foam_template:
|
||||
|
||||
const result = await engine.processTemplate(trigger, template, resolver);
|
||||
|
||||
// All invalid characters should become dashes
|
||||
expect(result.filepath.path).toBe('Test-------------Title-----.md');
|
||||
// All invalid characters should become dashes, and valid should stay unchanged
|
||||
expect(result.filepath.path).toBe("Test#%&{}----$!'-Title@+`-=.md");
|
||||
|
||||
// Content should remain unchanged
|
||||
expect(result.content).toContain('# Test#%&{}<>?*$!\'"Title@+`|=');
|
||||
|
||||
@@ -15,9 +15,9 @@ import { URI } from '../core/model/uri';
|
||||
/**
|
||||
* Characters that are invalid in file names
|
||||
* Based on UNALLOWED_CHARS from variable-resolver.ts but excluding filepaths
|
||||
* related chars
|
||||
* related chars and chars permissible in filepaths
|
||||
*/
|
||||
const FILEPATH_UNALLOWED_CHARS = '#%&{}<>?*$!\'"@+`|=';
|
||||
const FILEPATH_UNALLOWED_CHARS = '<>?*"|';
|
||||
|
||||
/**
|
||||
* Sanitizes a filepath by replacing invalid characters with dashes
|
||||
|
||||
Reference in New Issue
Block a user