Skip to content

Releases

3.2.1

Choose a tag to compare

@mydoxie mydoxie released this 14 Nov 02:50
dd5daec

Fixes

  • storage:install writes storage/app as the root of the local disk. Before, it wrote storage, so an unsigned Storage.route could also serve other folders there, like the file cache in storage/cache.

An app installed before is not changed. If it has an unsigned Storage.route, set the disk root to a folder that holds only public uploads.

Full list: CHANGELOG

3.2.0

Choose a tag to compare

@mydoxie mydoxie released this 13 Nov 10:48
26c6f3b

New

  • dox add storage [--disk=local|s3] writes the config, the provider, the storage folder and the .env keys. It never overwrites a file.
  • Storage().put(path, contents, exact: true) writes to that exact path and replaces an old file.
  • Storage().putFile(folder, file) and putFileAs(folder, file, name).
  • copy, move, files, allFiles, directories, deleteDirectory, missing, getVisibility and setVisibility are on Storage(). deleteDirectory refuses the root, so a bad path cannot empty a disk.
  • Storage().download(path, name: 'Invoice 42.pdf') sets the file name the browser saves.
  • Local disk option permissions: true: visibility is the real file mode (public 0644, private 0600). It is off by default. A private file is never open to others while it is written.
  • Ships an AI agent skill (dox-storage-guide). Install it with dart run skills@ get.
  • New dependency: dox_annotation.

Fixes

  • copy() and move() of a missing file made the new folders first. They now throw FileNotFoundException and make nothing.
  • size() and lastModified() of a missing file gave a 500. They now give a 404.
  • storeAs() and putRequestFileAs() returned the raw name, not the stored path.
  • directoryExists('') was true on a local disk and false on S3 and memory disks. It is now true everywhere.
  • A copy on a local disk is written to a temp file and renamed, so it can never empty its own source.

Do not pass the raw client file name to storeAs(). Make your own name.

Docs: File storage

Full list: CHANGELOG

3.1.0

Choose a tag to compare

@mydoxie mydoxie released this 08 Nov 11:45
3b81ce5

No breaking change. Signed URLs made before this version still work until they expire.

New

  • directoryExists(), size(), lastModified(), makeDirectory().
  • append() and prepend() add text to a file.
  • temporaryUrl(), the Laravel name for signedUrl().
  • assertExists() and assertMissing() for tests on a fake disk.
  • file.store(folder, disk: 's3') and file.storeAs(folder, name).
  • atomic_writes: a failed upload never leaves a partial file.
await file.store('avatars', disk: 's3');
drive.fake('s3').assertExists('a.png');

Fixes

  • url() on a local disk with no url option now gives /storage/<path>. Before, it threw.
  • New signed URLs include the disk name, so they only work on their own disk. They do not work on 3.0.1 after a downgrade.
  • Long file names with atomic_writes no longer fail.
  • append() and prepend() no longer fail when another writer deletes the file.

Docs: File storage, Storage package

Full list: the CHANGELOG.

3.0.1

Choose a tag to compare

@necessarylion necessarylion released this 01 Nov 04:18
6fbe03e

Fix

  • Storage.route() decoded the file key twice. A key with a real %, like 100%.txt, gave the wrong file or a 500.

Needs dox_core 3.0.1 or newer.