Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

Commit

Permalink
sanitize all missing file paths
Browse files Browse the repository at this point in the history
  • Loading branch information
electrovir committed Jun 28, 2021
1 parent 6f85d5e commit 077fdec
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "itunes-library-migration-assistant",
"version": "0.0.7",
"version": "0.0.8",
"description": "iTunes Library Migration Assistant",
"keywords": [
"itunes",
Expand Down
3 changes: 3 additions & 0 deletions src/augments/string.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function sanitizeLocation(location: string): string {
return location.replace('%20', ' ');
}
8 changes: 6 additions & 2 deletions src/migration/make-new-library.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {existsSync} from 'fs';
import {InputPath, ReplacePath} from '../api/api-types';
import {sanitizeLocation} from '../augments/string';
import {LibraryMigrationError} from '../errors/library-migration-error';
import {LibraryParseError} from '../errors/library-parse-error';
import {ParsedLibrary, ParsedTrack, ParsedTracks} from './reading/parsed-types';
Expand Down Expand Up @@ -51,8 +52,11 @@ export function makeNewLibrary({
replacePath.old,
replacePath.new,
);
if (checkFiles && !existsSync(newTrack.Location.replace('%20', ' '))) {
missingFiles.push({old: oldLocation, new: newTrack.Location});
if (checkFiles && !existsSync(sanitizeLocation(newTrack.Location))) {
missingFiles.push({
old: sanitizeLocation(oldLocation),
new: sanitizeLocation(newTrack.Location),
});
}
used = true;
} else {
Expand Down

0 comments on commit 077fdec

Please sign in to comment.