Skip to content

Commit f716590

Browse files
authored
Fix overwrite+remove deleting the wrong file on relative path. (#235)
Issue was caused by updater.pathToNewFile() fetching the path directly from zSyncClient, which will keep absolute paths as-is and change relative paths to be different than the parameter value would be.
1 parent 524d3ff commit f716590

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/cli/main.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ int main(const int argc, const char** argv) {
6060

6161
optional<string> pathToAppImage = [&args]() {
6262
if (!args.pos.empty()) {
63-
return optional<string>(args.as<string>(0));
63+
// calculate absolute path to normalize the path for when it's
64+
// checked back from Updater::pathToNewFile
65+
return optional<string>(abspath(args.as<string>(0)));
6466
}
6567

6668
return optional<string>();
@@ -240,6 +242,9 @@ int main(const int argc, const char** argv) {
240242
return 1;
241243
}
242244

245+
// normalize against pathToAppImage - so they follow the same format
246+
newFilePath = abspath(newFilePath);
247+
243248
auto validationResult = updater.validateSignature();
244249

245250
while (updater.nextStatusMessage(nextMessage))

0 commit comments

Comments
 (0)