- const sourceFileName = sourceFile.split('/').filter(Boolean).slice(-1).join("");
- return {
- ...obj,
- [this.combineFilePath([destinationPath, sourceFileName])]: `${sourcePdh}${this.combineFilePath([sourceFile])}`,
- [this.combineFilePath([sourceFile])]: '',
- };
+ const fileBasename = sourceFile.split("/").filter(Boolean).slice(-1).join("");
+ const fileDestinationPath = this.combineFilePath([destinationPath, fileBasename]);
+ const fileSourcePath = this.combineFilePath([sourceFile]);
+ const fileSourceUri = `${sourcePdh}${fileSourcePath}`;
+
+ if (fileDestinationPath !== fileSourcePath) {
+ return {
+ ...obj,
+ [fileDestinationPath]: fileSourceUri,
+ [fileSourcePath]: "",
+ };
+ } else {
+ errors.push(CommonResourceServiceError.SOURCE_DESTINATION_CANNOT_BE_SAME);
+ return obj;
+ }