79115296

Date: 2024-10-22 18:09:35
Score: 0.5
Natty:
Report link

Make sure that your zip archive entry name/path doesn't start with a slash. Leading slashes are violating the ZIP format specification (https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT, section 4.4.17). While some ZIP utilities/libraries are tolerant of leading slashes, many others are not.

The sourceDirInfo.FullName string probably doesn't feature a trailing slash (unless you created the DirectoryInfo with a string that has a trailing slash), so doing file.FullName.Replace(sourceDirInfo.FullName, "") would leave you with a file path having a leading (back)slash, which is the likely cause of your problem.

(Side note: Replacing backslashes with forward slashes is correct, by the way.)

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: ZippydiZip