Skip to content

Commit

Permalink
Storage emulator fixes and added rewriteTo support (#3647)
Browse files Browse the repository at this point in the history
* Added missing return type

* Set default cache-control header

* Try to derive eTag from file bytes

* Use content-encoding from metadata

* Added in other file headers

* Improved comment

* Extracted out crc32c encoding to separate function

* Added in x-goog-hash header with encoded crc32c value and MD5 hash

* Match 404 object errors to API

* Fixed range requests

Simplified to use express' Request#range method and corrected end to be used as an inclusive bound

* When STORAGE_EMULATOR_DEBUG env is set, still return 501 status code

* Added support for rewriteTo and copyTo in the storage emulator

* Added contentDisposition into metadata

* Convert custom metadata values to strings and added integration test to admin SDK for removing values

* Match 404 object errors to API for non-GET endpoints

* Changed to use declared imports to match other fs usage

* No need to check for directory existence before trying to create it when using the recursive flag

* Stored files flat inside bucket directory, and URL encode the path components

* Fixed typo in skipped test

* Corrected list objects endpoint when using prefix and delimiter to return correct items and include prefixes

* Support for pageTokens and maxResults in objects: list

* Refactored Firebase storage#listAll endpoint to call generic listItems

* #upload test to check provided custom metadata is set

* Better tests for #copy to check original files metadata is copied

* Updated #copy() to overwrite all custom metadata, not only provided keys

* Updated #copy() to convert null custom metadata values to empty strings

* Refactored objects: rewrite / copy endpoint to method in storage layer

* Handle firebaseStorageDownloadTokens for objects: rewrite / copy

* Consistent case for constant test variable

* Changed iterating over objects with Object.keys to use Object.entries

* Clearer circumventing the type-system

* Base eTags on object generation and metadata generation for uniqueness across objects regardless of file content

* Refactored StorageLayer#listItemsAndPrefixes to use #listItems and moved specfic Firebase and gcloud formats to those APIs

* Removed unused import

* Handled cache control and content language metadata and added tests

* Integration tests for File#exists

* Updated CHANGELOG

* Comment on boolean argument

* Fixed end to end test storage import/export
  • Loading branch information
rhodgkins committed Mar 15, 2022
1 parent 9871e53 commit 9795181
Show file tree
Hide file tree
Showing 8 changed files with 845 additions and 187 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,8 @@
- Adds alerting event provider (#4258).
- Fixes bug where project-specific environment variables weren't loaded by the Functions Emulator (#4273).
- Fixes bug where CORS was enabled too broadly on the Functions emulator (#4294).
- Adds `rewriteTo` / `copyTo` endpoints to Cloud Storage Emulator (#3647, #3751).
- Addes `createReadStream` support to Cloud Storage Emulator (#3469).
- Fixes `list` endpoint in Cloud Storage Emulator (#3647).
- Fixes `getFiles` for Cloud Storage Emulator (#3778).
- Fixes `exists` for Cloud Storage Emulator (#3764).

0 comments on commit 9795181

Please sign in to comment.