Skip to content
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

omex complains about missing files in archive #52

Open
fbergmann opened this issue Aug 23, 2024 · 2 comments
Open

omex complains about missing files in archive #52

fbergmann opened this issue Aug 23, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@fbergmann
Copy link

I've noticed that when importing a omex archive in pymetadata, that it complains on windows about entries missing in the manifest, even though they are present.

Looking through the code, this is due to

file_path = os.path.join(root, file)

which on windows will create a string with a backslash as separator, if the file in the manifest is encoded with a slash, then the entry will not be able to be properly resolved.

@matthiaskoenig matthiaskoenig self-assigned this Aug 23, 2024
@matthiaskoenig matthiaskoenig added the bug Something isn't working label Aug 23, 2024
@matthiaskoenig
Copy link
Owner

@fbergmann Thanks for the report. I will fix this asap.

  • fix bug
  • add test
  • add windows to CI for testing

@fbergmann
Copy link
Author

thanks! locally i've solved it with just replacing the backslashes with forward ones and was able to get it running

       for root, _dirs, files in os.walk(str(directory)):
            for file in files:
                file_path = os.path.join(root, file)
                location = f"./{os.path.relpath(file_path, directory)}"
                if location == "./manifest.xml":
                    # manifest is created from the internal manifest entries
                    continue

                # replace backslashes with forward slashes  <--------
                location = location.replace("\\", "/")
                ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants