Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const trash = async (filePath, {filesPath, infoPath}) => {

const trashInfo = [
'[Trash Info]',
`Path=${filePath.replaceAll(/\s/g, '%20')}`,
`Path=${encodeURI(filePath)}`,
`DeletionDate=${formatDate(new Date())}`,
].join('\n');

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ npm install --global trash-cli
## Info

On macOS, [`macos-trash`](https://github.com/sindresorhus/macos-trash) is used.\
On Linux, the [XDG spec](https://standards.freedesktop.org/trash-spec/trashspec-1.0.html) is followed.\
On Linux, the [XDG spec](https://specifications.freedesktop.org/trash/1.0/) is followed.\
On Windows, [`recycle-bin`](https://github.com/sindresorhus/recycle-bin) is used.

## FAQ
Expand Down
6 changes: 3 additions & 3 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ test('symlinks', async () => {

if (process.platform === 'linux') {
test('create trashinfo', async () => {
fs.writeFileSync('f2', '');
fs.writeFileSync('f2 ^', '');

const info = `[Trash Info]\nPath=${path.resolve('f2')}`;
const files = await trash(['f2']);
const info = `[Trash Info]\nPath=${path.resolve(encodeURI('f2 ^'))}`;
const files = await trash(['f2 ^']);
const infoFile = fs.readFileSync(files[0].info, 'utf8');

assert.equal(infoFile.trim().indexOf(info.trim()), 0);
Expand Down