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

Incorrect max file upload size in placeholder text when first loading form in enketo #619

Open
mattlangeman opened this issue Jun 11, 2020 · 3 comments
Labels

Comments

@mattlangeman
Copy link

Not sure if this is only my setup or an issue for others.

Steps to reproduce:

  1. Create a new form with a file upload field
  2. Deploy the form
  3. Open the form (loads via enketo)
  4. The placeholder text shows a max file size of 5MB
  5. Fill in and Submit the form
  6. A new blank form will eventually load with the correct max file size (default 10MB)

KoboToolbox_-_Enketo_-_File_Upload

Notes:

a) You can actually submit a larger file (up to real 10MB limit) even when it says 5MB

b) If you refresh the page after step 6, the placeholder text goes back to 5MB

c) I've increased the value of DEFAULT_CONTENT_LENGTH in common.py and this changes the real upload limit, the placeholder text still initially shows 5MB

d) I've dug around a little and see that enketo should be pulling this value from kobocat via the x-openrosa-accept-content-length header and 5MB seems to be the default that enketo sets in it's own settings DEFAULT_MAX_SIZE

@jnm
Copy link
Member

jnm commented Jun 17, 2020

Do you upload your forms directly to KoBoCAT (step 1) and/or invoke Enketo from KoBoCAT (step 2), or is KPI involved?

This won't solve the problem, but a useful reference for where attachment upload limits come from and how clients handle them is https://community.kobotoolbox.org/t/kobo-capacity-maxima-for-media-files/1787/5?u=jnm

@mattlangeman
Copy link
Author

I've been using KPI to create and deploy the form. I'm wondering if it has to do with the fact that I do not have SSL setup. I had issues getting it setup with Let's Encrypt, so am currently playing with a staging setup that does not have SSL setup. I am seeing a JS error in my Developer Toolbar that "Service workers are not supported on this browser" and my understanding is server workers need SSL.

I was also seeing this issue on another setup that had SSL setup, but it appears to have some issue with enketo authentication. I am seeing a "Failed to load resource: the server responded wth a status of 401 (Unauthorized) for /submission/max-size/::qEbVFQ4gl

My current guess is there are setup/configuration issues for these two setups and not actually and so I'm closing this ticket for now.

@jnm
Copy link
Member

jnm commented Jun 18, 2020

I just tested this with KPI on one of our production servers (kf.kobotoolbox.org), and I see the same problem where the incorrect < 5MB limit is shown until after the first submission is made. After that, it shows < 10MB as expected. I'm going to reopen the issue and leave it in this repo, assuming that it's somehow KoBoCAT's responsibility to communicate the right upload limit to Enketo. This might not be quite right, but we'll see.

@jnm jnm reopened this Jun 18, 2020
@jnm jnm added the bug label Jun 18, 2020
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