From: Michael Tremer Date: Sun, 17 Jul 2022 09:44:50 +0000 (+0000) Subject: files: Strip leading "./" from filenames X-Git-Tag: 0.9.28~705 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9f703e54042893445a953c1f46a5f3d8969c4a2;p=pakfire.git files: Strip leading "./" from filenames mtree adds ./ to every file that is being written to the archive, but that is not very useful for us. Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/file.c b/src/libpakfire/file.c index cf7f38b97..c0d539f47 100644 --- a/src/libpakfire/file.c +++ b/src/libpakfire/file.c @@ -153,7 +153,14 @@ int pakfire_file_copy_archive_entry(struct pakfire_file* file, struct archive_en pakfire_file_set_abspath(file, archive_entry_sourcepath(entry)); // Set path - pakfire_file_set_path(file, archive_entry_pathname(entry)); + const char* path = archive_entry_pathname(entry); + if (path) { + // Strip any leading dots from paths + if (pakfire_string_startswith(path, "./")) + path++; + + pakfire_file_set_path(file, path); + } // Set size pakfire_file_set_size(file, archive_entry_size(entry));