class
MartenRailsBridge::ActiveStorage::Representations::RedirectHandlerUrlFormatsTest
- MartenRailsBridge::ActiveStorage::Representations::RedirectHandlerUrlFormatsTest
- Minitest::Test
- Minitest::Runnable
- Reference
- Object
Overview
The URL formats a consumer can mount this handler on.
The handler reads the signed_blob_id and variation_key route parameters and never looks at the
path, so every format below is served identically. These tests pin that, and pin the one way a
consumer can get the route declaration wrong.
:nodoc:
Defined in:
active_storage/representations/redirect_handler_test.crConstant Summary
-
BLOB_KEY =
"gz0zdzhk0yn6zjhxfzl6qt1ys5rj" -
MEDIUM_DIGEST =
"1349c67feef77f80b95ba12d5ee190149ed47e212ff4fffb0a237b33a3c313a5"
Instance Method Summary
- #setup
- #teardown
-
#test_a_custom_routes_prefix_resolves
ActiveStorage.routes_prefixis configurable, so the prefix is not fixed. - #test_every_url_format_returns_404_for_a_tampered_variation_key
- #test_every_url_format_serves_the_same_redirect
-
#test_legacy_route_declared_first_swallows_the_modern_path
Declaring the pre-6.1 alias before the specific route makes it match
redirectas thesigned_blob_id, which then fails verification. - #test_the_filename_glob_spans_several_segments
-
#test_the_filename_in_the_path_does_not_affect_the_response
The filename only shapes the URL: Rails serves the variant filename derived from the blob, so a mismatched filename in the path changes nothing.
- #test_the_filename_may_contain_spaces_and_dots
-
#test_the_legacy_path_without_the_redirect_segment_resolves
The pre-6.1 path, which Rails still ships as an unnamed alias of the redirect controller.
-
#test_the_named_redirect_path_resolves
GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename
Instance Method Detail
ActiveStorage.routes_prefix is configurable, so the prefix is not fixed.
Declaring the pre-6.1 alias before the specific route makes it match redirect as the
signed_blob_id, which then fails verification. Rails avoids this by drawing the alias last.
The filename only shapes the URL: Rails serves the variant filename derived from the blob, so a mismatched filename in the path changes nothing.
The pre-6.1 path, which Rails still ships as an unnamed alias of the redirect controller. A Rails app upgraded from 6.0 keeps serving URLs in this shape.
GET /rails/active_storage/representations/redirect/:signed_blob_id/:variation_key/*filename