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

Error: File must be file instance with ZIP extension #5274

Closed
2 tasks done
Harsturomai opened this issue Nov 10, 2022 · 4 comments · Fixed by #5386
Closed
2 tasks done

Error: File must be file instance with ZIP extension #5274

Harsturomai opened this issue Nov 10, 2022 · 4 comments · Fixed by #5386
Assignees
Labels
bug Something isn't working Easy to fix The issue is easy to fix and probably it will be release in a next minor release

Comments

@Harsturomai
Copy link

My actions before raising this issue

Expected Behaviour

Expected to be able to upload custom annotations that aren't necessarily .zip, especially when the signature for adding an annotation import allows for different extensions.

@importer(name="MyFormat", version="2.0", ext="XML")

Current Behaviour

Throws Error: File must be file instance with ZIP extension when trying to upload.

Possible Solution

It seems to be a validation bug on the UI side. Can be fixed by removing validation step cvat-core/src/annotations.ts:line 312

throw new ArgumentError('File must be file instance with ZIP extension');

I may well be missing something in the docs here, but even if I am, I'd like to just be able to upload a single json file that contains annotations in a custom format.

@zhiltsov-max zhiltsov-max added bug Something isn't working Easy to fix The issue is easy to fix and probably it will be release in a next minor release ui labels Nov 11, 2022
@zhiltsov-max
Copy link
Contributor

@bsekachev , please look at this issue. It seems that UI imposes extra limitations, the server supports non-zip files in several formats.

@Harsturomai
Copy link
Author

Thanks for looking into this. Please note also, that when exporting datasets using @exporter without saving images, the UI also asserts saving a .zip file regardless of the extension specified in the function. I won't create a separate issue as these are tightly coupled. I similarly hot-patched this - but would be good to see a proper solution.

Can I ask, how will I know when such fixes are implemented? Will they be pushed to the develop branch or will a separate branch be created?

@zhiltsov-max
Copy link
Contributor

Please note also, that when exporting datasets using @Exporter without saving images, the UI also asserts saving a .zip file regardless of the extension specified in the function.

I wouldn't consider this a bug, because currently we always expect archives from the export. They may contain just a single file in some cases (e.g. TF export of a project with 1 subset, CVAT for * with 1 project subset and only annotations), but in this case the limitation is intended.

Can I ask, how will I know when such fixes are implemented?

Typically, we link PRs to issues they affect, so the issues get closed after merging or, at least, be referenced in the discussion.

Will they be pushed to the develop branch or will a separate branch be created?

We prepare fixes in separate branches, then merge into develop.

@Harsturomai
Copy link
Author

Makes sense, thanks. One comment on the export. When CVAT saves the export as a .zip, the single JSON file I return from my exporter (with EXT=JSON) is saved as json, but with a .zip extension. Therefore, I cannot extract the file, but have to replace the .zip with .json. Perhaps either the exporter should be required to return a .zip, or CVAT should internally wrap it up into one.

@bsekachev bsekachev self-assigned this Nov 11, 2022
@nmanovic nmanovic assigned klakhov and unassigned bsekachev Nov 19, 2022
bsekachev pushed a commit that referenced this issue Nov 30, 2022
<!-- Raised an issue to propose your change
(https://github.com/cvat-ai/cvat/issues).
It helps to avoid duplication of efforts from multiple independent
contributors.
Discuss your ideas with maintainers to be sure that changes will be
approved and merged.
Read the
[CONTRIBUTION](https://github.com/cvat-ai/cvat/blob/develop/CONTRIBUTING.md)
guide. -->

<!-- Provide a general summary of your changes in the Title above -->

### Motivation and context
<!-- Why is this change required? What problem does it solve? If it
fixes an open
issue, please link to the issue here. Describe your changes in detail,
add
screenshots. -->
Resolved #5274
+ Fixed typo in tests

### How has this been tested?
<!-- Please describe in detail how you tested your changes.
Include details of your testing environment, and the tests you ran to
see how your change affects other areas of the code, etc. -->

### Checklist
<!-- Go over all the following points, and put an `x` in all the boxes
that apply.
If an item isn't applicable by a reason then ~~explicitly
strikethrough~~ the whole
line. If you don't do that github will show an incorrect process for the
pull request.
If you're unsure about any of these, don't hesitate to ask. We're here
to help! -->
- [x] I submit my changes into the `develop` branch
- [x] I have added a description of my changes into
[CHANGELOG](https://github.com/cvat-ai/cvat/blob/develop/CHANGELOG.md)
file
- [ ] I have updated the [documentation](
https://github.com/cvat-ai/cvat/blob/develop/README.md#documentation)
accordingly
- [x] I have added tests to cover my changes
- [x] I have linked related issues ([read github docs](

https://help.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword))
- [x] I have increased versions of npm packages if it is necessary
([cvat-canvas](https://github.com/cvat-ai/cvat/tree/develop/cvat-canvas#versioning),

[cvat-core](https://github.com/cvat-ai/cvat/tree/develop/cvat-core#versioning),
[cvat-data](https://github.com/cvat-ai/cvat/tree/develop/cvat-data#versioning)
and
[cvat-ui](https://github.com/cvat-ai/cvat/tree/develop/cvat-ui#versioning))

### License

- [x] I submit _my code changes_ under the same [MIT License](
https://github.com/cvat-ai/cvat/blob/develop/LICENSE) that covers the
project.
  Feel free to contact the maintainers if that's a concern.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Easy to fix The issue is easy to fix and probably it will be release in a next minor release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants