firebase / firebase-tools

The Firebase Command Line Tools
MIT License
3.97k stars 915 forks source link

Fix issue where emulator throws an error due to non-standard whitespaces in filenames #7308

Closed aalej closed 2 weeks ago

aalej commented 2 weeks ago

Description

Fixes #6834

Encodes the Content-Disposition header. See reference's example section

Scenarios Tested

Tested the scenario:

  1. Opening the file with non-standard whitespace directly from console UI
  2. Downloading the file with non-standard whitespace via using a Web Application
  3. Uploading a file with non-standard whitespace that triggers onFinalize() Cloud Function which downloads the file

See https://github.com/aalej/issues-6834-pr-test

Scenario 1

  1. Run firebase emulators:start --project demo-project --import ./emulator-data
  2. Go to http://127.0.0.1:4000/storage/demo-project.appspot.com
  3. Click "invalid whitespace.png"
    • Image loads

Scenario 2

  1. Run firebase emulators:start --project demo-project --import ./emulator-data
  2. On a new terminal, run cd web-app, then npm run start
  3. Go to http://localhost:3000/
  4. Click "Download" button
    • Image is loaded on the UI

Scenario 3

  1. Run firebase emulators:start --project demo-project
  2. Go to http://127.0.0.1:4000/storage/demo-project.appspot.com
  3. Upload file located in ./images/invalid whitespace.png
    • Function finishes executing
      i  functions: Beginning execution of "us-central1-firstGenGenerateThumbnail"
      i  functions: Finished "us-central1-firstGenGenerateThumbnail" in 119.516208ms

Sample Commands

N/A