RickStrahl / Westwind.HtmlPackager

A small utility class used to package HTML content into a self contained HTML document both as a single file, or a folder with all dependencies copied to local.
36 stars 9 forks source link

MAJOR: Deletes files in folder #4

Open nitrocalcite opened 4 years ago

nitrocalcite commented 4 years ago

Apparently, this tool will delete all files in the directory without warning or prompting that share the name of the file you attempted to process under a certain error condition.

I've been attempting to use the prepackaged exe version.
I'm getting this error:

Unhandled Exception: System.UnauthorizedAccessException: Access to the path '$the_path\HtmlPackager.exe' is denied.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at System.IO.File.Delete(String path)
   at Westwind.HtmlPackager.HtmlPackager.PackageHtmlToFolder(String urlOrFile, String outputFile, String basePath, Boolean deleteFolderContents)
   at HtmlPackager.HtmlPackagerProcessor.Process()
   at HtmlPackager.Program.Main(String[] args)

When this error (but not others) occurs, files get deleted. So, attempting to process name.html will delete name.bib and name.adoc and name.html and so on and so forth!

I have no idea why this would be. I lost work, but thankfully I had backups.

Use with extreme caution.

nitrocalcite commented 4 years ago

Update: Identical behavior observed with v0.1.2's executable as well. For those who stumble upon this looking for an alternative, this Python solution worked for me.