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

[Bug] Error when uploading files with & in filename #11900

Closed
atdservicebot opened this issue Mar 31, 2023 · 4 comments
Closed

[Bug] Error when uploading files with & in filename #11900

atdservicebot opened this issue Mar 31, 2023 · 4 comments
Assignees
Labels
Impact: 1-Severe Severely impacts TPW service delivery Product: Moped A comprehensive mobility project tracking platform for Austin, Texas Type: Bug Report Something is not right Workgroup: AMD Arterial Management Division

Comments

@atdservicebot
Copy link

atdservicebot commented Mar 31, 2023

See also:

What application are you using?

Moped

Describe the problem.

Error: Cannot retrieve file signature for file 'William Cannon & Bannockburn 3-2-23.pdf'. Please reload your page and try again or contact the Data & Technology Services department. Feedback message: 403 -

Website Address

https://mobility.austin.gov/moped/projects/218?tab=files

Internet Browser: Chrome

Requested By
Billy B.

Attachment (65.28kb)

Request ID: DTS23-106905

@atdservicebot atdservicebot added Impact: 1-Severe Severely impacts TPW service delivery Product: Moped A comprehensive mobility project tracking platform for Austin, Texas Type: Bug Report Something is not right Workgroup: AMD Arterial Management Division labels Mar 31, 2023
@atdservicebot atdservicebot self-assigned this Mar 31, 2023
@patrickm02L patrickm02L changed the title [URGENT] Error: Cannot retrieve file signature for file 'William Cannon & Bannockburn 3-2-23.pdf'. Please rel... [URGENT] Error: Cannot retrieve file signature for file 'William Cannon & Bannockburn 3-2-23.pdf' Mar 31, 2023
@ChristinaTremel
Copy link

@johnclary assigning this to you because this is an error Billy is receiving in Moped!

@johnclary
Copy link
Member

thanks @ChristinaTremel! I was unable to reproduce the issue on Friday. I'm waiting to hear back from Billy.

@johnclary johnclary changed the title [URGENT] Error: Cannot retrieve file signature for file 'William Cannon & Bannockburn 3-2-23.pdf' [Bug] Error when uploading files Apr 12, 2023
@johnclary
Copy link
Member

johnclary commented Apr 12, 2023

this is caused by the & character in the filename. i can reproduce this in staging and prod, but not by running the Moped API file name validations locally. my suspicion is that some layer between the inbound moped request and flask is not handling the character encoding correctly. i'm going to open a PR to get better logging out of the Moped api.

@johnclary johnclary changed the title [Bug] Error when uploading files [Bug] Error when uploading files with & in filename Apr 12, 2023
@johnclary
Copy link
Member

johnclary commented Apr 12, 2023

this appears to be a known issue with Zappa (#1227).

to recap exactly what's happening:

  1. In Moped, try to upload a file with a & in the filename. e.g.: 1131_Howard & Cantarra Plan Sheets.pdf
  2. You should get the red alert/error message as shown here.
  3. Through your browser console, observe the GET request query string sent to the Moped API:
    file=1131_Howard%20%26%20Cantarra%20Plan%20Sheets.pdf&project_id=1769
    The decoded query string:
file: 1131_Howard & Cantarra Plan Sheets.pdf
project_id: 1769`
  1. And observer the GET response payload
{
    "filename": "1131_Howard ",
    "message": "Invalid file name",
    "status": "error"
}

As you can see, the filename that was handled by the API (1131_Howard) does not match the filename that was sent, and is in turn causing this is_valid_filename test to fail.

I see two workarounds:

  1. Strip out the & from filenames in Moped Editor before sending them to the API. As is, we already transform the filenames before saving the files in S3, so I don't think users should notice this or have a problem with it. I estimate that as a 2.

  2. In the Moped API, change the files/request-signature endpoint to receive a POST request instead of a GET request. That way we can send a JSON request body that does does not need to be URL encoded. I estimate this as a...5?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Impact: 1-Severe Severely impacts TPW service delivery Product: Moped A comprehensive mobility project tracking platform for Austin, Texas Type: Bug Report Something is not right Workgroup: AMD Arterial Management Division
Projects
None yet
Development

No branches or pull requests

3 participants