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

Upload of app with invalid archive fails with 500 #590

Closed
MorrisJobke opened this issue Jan 7, 2019 · 2 comments
Closed

Upload of app with invalid archive fails with 500 #590

MorrisJobke opened this issue Jan 7, 2019 · 2 comments
Labels

Comments

@MorrisJobke
Copy link
Member

The UI doesn't reflect if there happens a 500 during upload of an invalid archive:

Traceback (most recent call last):
  File "/usr/lib/python3.5/tarfile.py", line 1629, in gzopen
    t = cls.taropen(name, mode, fileobj, **kwargs)
  File "/usr/lib/python3.5/tarfile.py", line 1605, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/usr/lib/python3.5/tarfile.py", line 1470, in __init__
    self.firstmember = self.next()
  File "/usr/lib/python3.5/tarfile.py", line 2279, in next
    tarinfo = self.tarinfo.fromtarfile(self)
  File "/usr/lib/python3.5/tarfile.py", line 1082, in fromtarfile
    buf = tarfile.fileobj.read(BLOCKSIZE)
  File "/usr/lib/python3.5/gzip.py", line 274, in read
    return self._buffer.read(size)
  File "/usr/lib/python3.5/_compression.py", line 68, in readinto
    data = self.read(len(byte_view))
  File "/usr/lib/python3.5/gzip.py", line 461, in read
    if not self._read_gzip_header():
  File "/usr/lib/python3.5/gzip.py", line 409, in _read_gzip_header
    raise OSError('Not a gzipped file (%r)' % magic)
OSError: Not a gzipped file (b'us')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/appstore/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/opt/appstore/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/opt/appstore/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/opt/appstore/venv/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/opt/appstore/venv/lib/python3.5/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/opt/appstore/venv/lib/python3.5/site-packages/rest_framework/views.py", line 483, in dispatch
    response = self.handle_exception(exc)
  File "/opt/appstore/venv/lib/python3.5/site-packages/rest_framework/views.py", line 443, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/opt/appstore/venv/lib/python3.5/site-packages/rest_framework/views.py", line 480, in dispatch
    response = handler(request, *args, **kwargs)
  File "/opt/appstore/nextcloudappstore/api/v1/views.py", line 181, in post
    info, data = provider.get_release_info(url, is_nightly)
  File "/opt/appstore/nextcloudappstore/api/v1/release/provider.py", line 34, in get_release_info
    meta = self.extractor.extract_app_metadata(download.filename)
  File "/opt/appstore/nextcloudappstore/api/v1/release/parser.py", line 74, in extract_app_metadata
    with tarfile.open(archive_path, 'r:gz') as tar:  # type: ignore
  File "/usr/lib/python3.5/tarfile.py", line 1575, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/lib/python3.5/tarfile.py", line 1633, in gzopen
    raise ReadError("not a gzip file")
tarfile.ReadError: not a gzip file
Internal Server Error: /api/v1/apps/releases

cc @BernhardPosselt @adsworth

Found by @violoncelloCH in nextcloud/user_external#26 (comment)

@MorrisJobke
Copy link
Member Author

And by @skjnldsv today

@BernhardPosselt
Copy link
Member

BernhardPosselt commented Jan 22, 2019

Ah, should be a 400

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants