-
-
Notifications
You must be signed in to change notification settings - Fork 248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix package exporter work for paths w/ international letters #1847
Conversation
Using the "package exporter (experimental)" from menu, and selecting a few items to export (no additional files added), this still produces an empty 0kb XML file in the ZIP. :( edit: win7 with non-ASCII filepath |
Try the new commit, though I am not certain it will address the issue. |
New commit does also fail. |
QString fname = contents[i]; | ||
if (fname == "." || fname == "..") { | ||
QString moduleFile = contents[i]; | ||
if (moduleFile == "." || moduleFile == "..") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if
can be removed if line 275 is changed to:
QStringList contents = dir.entryList(QDir::NoDotAndDotDot);
However since the code here will die horribly if any directories are fed to zip_file_add
it may perhaps be wise to actually use:
QStringList contents = dir.entryList(QDir::Files);
at least until the code is fixed to handle modules with sub-directories...
Yes, though the original problem is still there, so it doesn't really matter to move some code around... 😞 |
I'll start looking into this again. I can just create a folder called |
I think I tested with a non-ASCII user name (windows user) and not quite sure if your way would yield the same result. |
How do you create such a user in windows? |
First stumbling block: https://bugreports.qt.io/browse/QTBUG-70751 |
Try the latest build, I've found the issue. Mudlet didn't seem to want to install the package on the non-ASCII user for me, but that's separate to the package exporter not working. |
@Kebap ping |
Exporting a package with non-ascii name will now produce output just like with a only-ascii name, however that output seems corrupt. See screenshot of test.xml file which does contain weird characters at the start, and not only readable text. Maybe it is just my text editor, but this seems wrong. Attached you can find the test.zip file with text.xml inside. Again, same contents as if the zip is created with non-ascii name, so that is working (somehow) |
Actually that text looks as though it is a sort of Pascal string formatted UTF-16 text (Pascal format means the characters of the text are preceded by an integer - 32 bit in this case - number of characters - which in this case seems to be the <aside>Blast it, I have just spent a day upgrading my FreeBSD from 11.2-RELEASE to 12.0-RELEASE and it still includes a version 27.x PaleMoon web-browser (fork of Firefox which maintains the older more functional and less Chromelike add-ons API) whereas I need the 28.x one to get Github post previews and some other things, like Emojis, working 😢)</aside> |
Vadi asked me to check if the error persists in the latest development branch, but I did not come around to it yet. That is, not this PR, but the branch named "development" |
Sorry, I'm not following you - this PR only fixes the handling of files to put into the zip file which had names that our code could not convey into the zip library code because we were confining ourselves to a Latin1 encoding in line 289 as it is in this PR. There are other changes which I guess have already made it into the package exporter which someone (@vadi2) will need to fixup to merge this PR into the main line code but provided you can store oddly named files in the package that is ALL that this PR addresses - so the fact that THIS PR seems to produce corrupt output is not the issue. You did say it yourself:
but as you then mentioned:
is that corruption ONLY for the non-ascii named file or is it the same for the same content in both files? |
Sorry for any confusion SlySven :) Like I said above, I am not going to test this PR, but only the main development branch compared to the current release version 3.16.1 - This may indeed be confusing, as we are writing in this PR. However, this is still the best place so far, as many issues are affected and no central issue links them all together like this PR does. So this is the update. Following tests happened on Win10. International character tested was like äöü. Did not test Asian characters or alike. There are quite a few racing error sources here, i.e. different places where the non-ASCII letters may occur, so seperate tests seem necessary as follows:
Setup:
Test results:
Setup:
Test results:
Setup:
Test results:
Setup:
Test results:
Summary:
|
Nice - so we can close this pr, then! |
Brief overview of PR changes/additions
Try @SlySven's suggestion from #1832 (comment) and use the
ZIP_FL_ENC_UTF_8
flag when giving the zip a name.Motivation for adding to Mudlet
Fix package exporter to work for Windows locations with international letters in them (#1790 (comment))
Other info (issues closed, discussion etc)
Fixes #1993