Skip to content

Instantly share code, notes, and snippets.

@bdunogier
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bdunogier/abb938de8be8c77ea69a to your computer and use it in GitHub Desktop.
Save bdunogier/abb938de8be8c77ea69a to your computer and use it in GitHub Desktop.
[spec] IO url prefix

IO URL decoration

Configuration

ezpublish:
  default:
    io:
      url_prefix: "$var_dir$/$storage_dir$"
        # S3 binary data handler storing to $var_dir$ folder
        # url_prefix: "http://s3-eu-west-1.amazonaws.com/my.bucket/$var_dir$"
        # nginx pointed directly to ezpublish-legacy/var/ezdemo_site/storage
        # url_prefix: "http://static.site.com"

LegacyStorage

Problem: the uri sent by the SPI might be completely different (http://s3-eu-...) from what legacy expects (var/site/storage/...) when storing images .

UrlRedecorator

An UrlDecorator is used to transform back & forth between two UrlDecorator.

One redecorator is added to the legacy image converter, with the source url decorator set to the "real" one, and the target to a legacy_url_decorator with $var_dir$/$storage_dir$ as the prefix.

The redecorator is used to convert uris between the two schemes depending on the expectations.

AbsoluteUrl decorator

Must be changed to also accept 'http' links (simple parse_url + scheme detection). The initial '/' should only be added if the prefix doesn't have a scheme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment