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

Fix image uploading to work on safari / iOS #2913

Open
DonnieBLT opened this issue Nov 13, 2024 · 8 comments
Open

Fix image uploading to work on safari / iOS #2913

DonnieBLT opened this issue Nov 13, 2024 · 8 comments
Assignees

Comments

@DonnieBLT
Copy link
Collaborator

No description provided.

@krrish-sehgal
Copy link
Contributor

Sir in what section it seems to be failing? asking because i checked on user profile edit page , upload image seems to working fine there through safari.

@DonnieBLT
Copy link
Collaborator Author

DonnieBLT commented Nov 13, 2024

This is for the reporting an issue page only on mobile

@krrish-sehgal
Copy link
Contributor

okay , the email needs to be verified to submit an issue, but I am having difficulty tracking down the email verification feature...
could you help me with it?

@DonnieBLT
Copy link
Collaborator Author

Email does not have to be verified because users can submit issues anonymously The issue is posted, but the image is not attached

@krrish-sehgal
Copy link
Contributor

krrish-sehgal commented Nov 14, 2024

Understood, although when a signed in user or even the signed out user currently tries to report a bug , it gives the email not verified error message or redirect to issues page.
nevertheless I would like to fix this bug and work on the issue as well.
Thanks.

@krrish-sehgal
Copy link
Contributor

/assign

Copy link
Contributor

Hello @krrish-sehgal! You've been assigned to OWASP-BLT/BLT. You have 24 hours to complete a pull request. To place a bid and potentially earn some BCH, type /bid [amount in BCH] [BCH address].

@krrish-sehgal
Copy link
Contributor

@DonnieBLT sir, I have been working on this issue and have some analysis and, to proceed further, I wanted to take some help.

So first of all it seems like the problem is not that image is not uploading from safari or ios because even if we try to upload through chrome, the image sometimes renders and sometimes doesnt.

On analysing the error in the backend , which is "
django.db.utils.OperationalError: database is locked
[15/Nov/2024 03:03:04] "GET /media/screenshots/home.pngca2ea533-6329-48ad-b3fb-54bffa17.png HTTP/1.1" 500 159625
[15/Nov/2024 03:03:04,186] - Broken pipe from ('127.0.0.1', 54388)"

there's a race condition or deadlock being produced between 2 queries trying to read/write the database.
More specifically there can be 2 possible things happening here ,

First(highly likely)
When i tried to log all the queries i found that just before the "image get" request there are some queries running

before error is produced:
"DEBUG:django.db.backends:(0.000) SELECT "website_ip"."id", "website_ip"."address", "website_ip"."user", "website_ip"."issuenumber", "website_ip"."created", "website_ip"."agent", "website_ip"."count", "website_ip"."path", "website_ip"."method", "website_ip"."referer" FROM "website_ip" WHERE "website_ip"."id" = 1 LIMIT 21; args=(1,); alias=default
(0.000) SELECT "website_ip"."id", "website_ip"."address", "website_ip"."user", "website_ip"."issuenumber", "website_ip"."created", "website_ip"."agent", "website_ip"."count", "website_ip"."path", "website_ip"."method", "website_ip"."referer" FROM "website_ip" WHERE "website_ip"."id" = 1 LIMIT 21; args=(1,); alias=default
(0.000) SELECT "website_ip"."id", "website_ip"."address", "website_ip"."user", "website_ip"."issuenumber", "website_ip"."created", "website_ip"."agent", "website_ip"."count", "website_ip"."path", "website_ip"."method", "website_ip"."referer" FROM "website_ip" WHERE "website_ip"."id" = 1 LIMIT 21; args=(1,); alias=default

DEBUG:django.db.backends:(0.000) SELECT "website_ip"."id", "website_ip"."address", "website_ip"."user", "website_ip"."issuenumber", "website_ip"."created", "website_ip"."agent", "website_ip"."count", "website_ip"."path", "website_ip"."method", "website_ip"."referer" FROM "website_ip" WHERE "website_ip"."id" = 1 LIMIT 21; args=(1,); alias=default

Internal Server Error: /media/screenshots/bruger.jpe8fc54280-dde8-4da8-a116-b1436c.jpeg
Traceback (most recent call last):"

so maybe the race condition is between these two but i am unable to locate where the query is getting triggered from.

Second (Less likely)
in _bug.html when we call this
"img class="bug-img h-[100%] w-[200px] object-contain"
src="{{ bug_screenshots.0.image.url }}"
alt="bug screenshot"
width="200px"
height="100%"
{% else %}"

here image.url tries to access the database several times, but i checked with one at a time as well... the image was randomly rendering and sometimes not.

Do you have any comments on the direction i am proceeding with or anything else you would like to mention?
Thanks.

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

No branches or pull requests

2 participants