Skip to content

Commit baae23d

Browse files
authored
Merge pull request #43 from irohalab/fix-file-manager
Fix FileManageService
2 parents eb4f8e5 + 13e7799 commit baae23d

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/services/FileManageService.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,18 @@ export class FileManageService {
6060
if (hostURLObj.hostname === 'localhost') {
6161
convertedRemoteFile.fileLocalPath = remoteFile.fileLocalPath;
6262
}
63-
// replace part
64-
const fileURLObj = new URL(remoteFile.fileUri);
65-
fileURLObj.host = hostURLObj.host;
66-
fileURLObj.protocol = hostURLObj.protocol;
67-
fileURLObj.pathname = FileManageService.trimEndSlash(hostURLObj.pathname) + fileURLObj.pathname;
68-
convertedRemoteFile.fileUri = fileURLObj.toString();
63+
if (remoteFile.fileUri) {
64+
try {
65+
// replace part
66+
const fileURLObj = new URL(remoteFile.fileUri);
67+
fileURLObj.host = hostURLObj.host;
68+
fileURLObj.protocol = hostURLObj.protocol;
69+
fileURLObj.pathname = FileManageService.trimEndSlash(hostURLObj.pathname) + fileURLObj.pathname;
70+
convertedRemoteFile.fileUri = fileURLObj.toString();
71+
} catch (ex) {
72+
logger.warn(ex);
73+
}
74+
}
6975
} else {
7076
convertedRemoteFile.fileUri = remoteFile.fileUri;
7177
}

0 commit comments

Comments
 (0)