-
Notifications
You must be signed in to change notification settings - Fork 178
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
[BUG] - Import Code Fails with "Invalid or unsupported zip format. No END header found" #933
Comments
On my machine importing the profile code you provided works as expected. Or in other words, I'm personally unable to reproduce this. Let me know if you manage to log anything more detailed. For starters, can you check what's happening with the network traffic if you have the inspector open? (Ctrl+Shift+I should work I think) |
I am having trouble getting the devtools console to open at all; be it on the available production build and running locally with Edit: After doing some digging, it appears other Linux users are having this issue with Electron 11 and the devtools not appearing. Once I get this resolved, I will return to posting more detail on this issue relating to the mod manager. |
This has been narrowed down a bit from my understanding, and the issue seems to be that Thunderstore Mod Manager creates ZIP exports via some C# built-ins, and the resulting archive does not seem to function on the nodjs side (r2modman). This results in exports created from TMM to not be loadable in r2modman. We're not sure what specifically causes this disparity and I've not personally verified it either. In case someone is interested in looking into it more, here's a sample of the c# zip creation code: namespace Zipper
{
public class ZipCreator
{
private static readonly Dictionary<String, KeyValuePair<MemoryStream, ZipArchive>> Archives =
new Dictionary<string, KeyValuePair<MemoryStream, ZipArchive>>();
public void RequestKey(Action<object> callback)
{
string key;
while ((key = Guid.NewGuid().ToString()).Length > 0 && Archives.ContainsKey(key)) { }
var stream = new MemoryStream();
Archives.Add(key, new KeyValuePair<MemoryStream, ZipArchive>(stream, new ZipArchive(stream, ZipArchiveMode.Update)));
callback(Utilities.JsonEncode(new Result(ResultType.STRING, key)));
}
public void AddBuffer(string key, string name, byte[] buffer, Action<object> callback)
{
Archives[key].Value.CreateEntry(name);
Archives[key].Value.GetEntry(name)?.Open().Write(buffer, 0, buffer.Length);
callback(Utilities.JsonEncode(new Result(ResultType.SUCCESS, null)));
}
public void AddFolder(string appName, string appId, string key, string folder, string folderName, Action<object> callback)
{
callback(Utilities.RunSafe(appName, appId, folder, () =>
{
AddFolderInternal(key, folder, folderName);
return new Result(ResultType.SUCCESS, null);
}));
}
private void AddFolderInternal(string key, string folder, string folderName)
{
var safeFolder = Utilities.SanitisePath(folder);
foreach (var file in Directory.GetFiles(safeFolder))
{
var zip = Archives[key].Value;
zip.CreateEntryFromFile(file, Path.Combine(folderName, new FileInfo(file).Name));
}
foreach (var directory in Directory.GetDirectories(safeFolder))
{
AddFolderInternal(key, directory, Path.Combine(folderName, new DirectoryInfo(directory).Name));
}
}
public void Create(string appName, string appId, string key, string output, Action<object> callback)
{
Archives[key].Value.Dispose();
var buffer = Archives[key].Key.GetBuffer();
new FileOperations().WriteFile(appName, appId, output, buffer, callback);
}
}
} |
The file downloaded by the manager isn't a raw zip file, but rather a base64 encoded zip with a string prefix of The code snippet encoding the content is as follows: const profileBuffer = '#r2modman\n' + (await fs.base64FromZip(exportPath)); |
This should be addressed on the thunderstore mod manager side now in that profile exports crated with version 1.37.0 or upwards no longer contain extra data at the end of the file. Older profile exports are still of course incompatible. |
Describe the bug
This issue is occurring with Valheim, but I suspect that #916 is experiencing the same issue with RoR2. A friend of mine is exporting their mod profile as a code so that I may import the mod profile as a code. Attempting to do so produces the error, "Invalid or unsupported zip format. No END header found".
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A new profile should be created containing the mods associated with the exported profile represented by the code.
Screenshots
Additional context
The code that we were using: 0185868e-7969-ef67-b878-7db08f3a0d45
The mod zip file appears to be found over HTTPS. Perhaps the zip file is not downloaded completely before the extraction process begins?
The error is caught and displayed in the following code from
src/pages/Profiles.vue
and would be a good place to start investigating. Will do this myself if there is time; otherwise this could be a good first issue for others.My setup may be a factor in the presence of this error.
The text was updated successfully, but these errors were encountered: