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

Problem with uploading screenshots #3756

Open
StefanPajovic opened this issue Aug 27, 2024 · 1 comment
Open

Problem with uploading screenshots #3756

StefanPajovic opened this issue Aug 27, 2024 · 1 comment

Comments

@StefanPajovic
Copy link

Hello,

I have an issue when uploading screenshots for my tests in Kiwi TCMS.
Namely, when I try to upload a photo during a test run, I sometimes get the reply: Internal error: {'attachment_file': ['File contains forbidden tag: ']} (see screenshot):

Kiwi error

I cannot provide you more info regarding this bug because there is no exact environment it happens in. I am always trying to upload screenshots (no HTML or anything similar) that are named in Latin characters. They also contain commas and full stops but that shouldn't be a problem. When this bug occured, I tried restarting Kiwi but it didn't help; as if the screenshot had some tag that made it unuploadable to Kiwi. I try then making the exact same screenshot and naming it exactly the same as the problematic one. This works, as it instantly uploads.

My dev team directed me to you to try and find a solution: have you encountered similar bugs and is there any way to resolve them?
I would like to add that this issue used to occur up a month ago. Before that, it happened on average to every tenth picture I tried to upload.

Thank you in advance for all your help. :)

@lmoellendorf
Copy link

I have the same issue

This is the log if a png is uploaded in the test case editor:

[-32603] Internal error: {'attachment_file': ['File contains forbidden tag: <xmp>']}
Traceback (most recent call last):
  File "/venv/lib64/python3.11/site-packages/modernrpc/core.py", line 143, in execute
    return self.function(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/tcms/rpc/api/user.py", line 185, in add_attachment
    utils.add_attachment(
  File "/venv/lib64/python3.11/site-packages/tcms/rpc/utils.py", line 103, in add_attachment
    raise ValueError(errors)
ValueError: {'attachment_file': ['File contains forbidden tag: <xmp>']}

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/venv/lib64/python3.11/site-packages/modernrpc/handlers/jsonhandler.py", line 182, in process_single_request
    result_data = _method.execute(context, args, kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/modernrpc/core.py", line 151, in execute
    raise RPCInternalError(str(exc)) from exc
modernrpc.exceptions.RPCInternalError: [-32603] Internal error: {'attachment_file': ['File contains forbidden tag: <xmp>']}
172.31.0.1 - - [03/Sep/2024:17:29:24 +0000] "POST /json-rpc/ HTTP/1.0" 200 152 "https://tcms.pe.loc/case/7/edit/" "Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0" "-"
[pid: 1170291|app: 0|req: 100959/200102] 172.31.0.1 () {62 vars in 1041 bytes} [Tue Sep  3 17:29:24 2024] POST /json-rpc/ => generated 152 bytes in 25 msecs (HTTP/1.0 200) 8 headers in 252 bytes (2 switches on core 0)

If a jpg is uploaded instead, the error changes to:

[-32603] Internal error: {'attachment_file': ['File contains forbidden tag: <rt>']}

It started after updating to v13.3 from a very old version (presumably 11.2).

It may be related to tcms.kiwi_attachments.validators as indicated in #3349.

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

No branches or pull requests

5 participants
@lmoellendorf @StefanPajovic and others