observe_filestore_credentials_revlookup/2

Resolve credentials for a file already registered at a remote service and location.

Type: first.

#filestore_credentials_revlookup{} properties:

  • service: stored backend identifier, such as <<"s3">>.
  • location: stored full remote URL.

Return {ok, #filestore_credentials{}} with service, service_url, location and backend-specific credentials, or undefined when the request cannot be handled. Records are defined in zotonic_file.hrl.

This reverse lookup preserves the stored location instead of deriving a new URL from current upload settings. The standard handler only supplies credentials for its configured service. Deletion separately checks that the stored URL matches the configured service URL, protecting files after a database is copied to a site with different storage settings. Never log or publish returned credentials.

See module#mod_filestore for service configuration and migration behavior.

Edit on GitHub

Observed by

Modules

mod_filestore

Store uploaded media and generated previews on S3-compatible storage, FTP/FTPS, or WebDAV. Zotonic keeps a database registry of remote files and serves them…