activestorage 6.0.6.1 → 6.1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of activestorage might be problematic. Click here for more details.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +230 -167
 - data/MIT-LICENSE +1 -1
 - data/README.md +35 -3
 - data/app/controllers/active_storage/base_controller.rb +11 -0
 - data/app/controllers/active_storage/blobs/proxy_controller.rb +14 -0
 - data/app/controllers/active_storage/{blobs_controller.rb → blobs/redirect_controller.rb} +2 -2
 - data/app/controllers/active_storage/direct_uploads_controller.rb +1 -1
 - data/app/controllers/active_storage/disk_controller.rb +8 -20
 - data/app/controllers/active_storage/representations/base_controller.rb +14 -0
 - data/app/controllers/active_storage/representations/proxy_controller.rb +13 -0
 - data/app/controllers/active_storage/{representations_controller.rb → representations/redirect_controller.rb} +2 -4
 - data/app/controllers/concerns/active_storage/file_server.rb +18 -0
 - data/app/controllers/concerns/active_storage/set_blob.rb +1 -1
 - data/app/controllers/concerns/active_storage/set_current.rb +2 -2
 - data/app/controllers/concerns/active_storage/set_headers.rb +12 -0
 - data/app/jobs/active_storage/mirror_job.rb +15 -0
 - data/app/models/active_storage/attachment.rb +19 -11
 - data/app/models/active_storage/blob/analyzable.rb +6 -2
 - data/app/models/active_storage/blob/identifiable.rb +7 -6
 - data/app/models/active_storage/blob/representable.rb +34 -4
 - data/app/models/active_storage/blob.rb +122 -57
 - data/app/models/active_storage/preview.rb +31 -10
 - data/app/models/active_storage/record.rb +7 -0
 - data/app/models/active_storage/variant.rb +31 -44
 - data/app/models/active_storage/variant_record.rb +8 -0
 - data/app/models/active_storage/variant_with_record.rb +54 -0
 - data/app/models/active_storage/variation.rb +26 -21
 - data/config/routes.rb +58 -8
 - data/db/migrate/20170806125915_create_active_storage_tables.rb +30 -9
 - data/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb +21 -0
 - data/db/update_migrate/20191206030411_create_active_storage_variant_records.rb +26 -0
 - data/lib/active_storage/analyzer/image_analyzer.rb +3 -0
 - data/lib/active_storage/analyzer/null_analyzer.rb +4 -0
 - data/lib/active_storage/analyzer/video_analyzer.rb +14 -3
 - data/lib/active_storage/analyzer.rb +6 -0
 - data/lib/active_storage/attached/changes/create_many.rb +1 -0
 - data/lib/active_storage/attached/changes/create_one.rb +17 -4
 - data/lib/active_storage/attached/many.rb +4 -3
 - data/lib/active_storage/attached/model.rb +67 -14
 - data/lib/active_storage/attached/one.rb +4 -3
 - data/lib/active_storage/engine.rb +41 -43
 - data/lib/active_storage/errors.rb +3 -0
 - data/lib/active_storage/gem_version.rb +3 -3
 - data/lib/active_storage/log_subscriber.rb +6 -0
 - data/lib/active_storage/previewer/mupdf_previewer.rb +3 -3
 - data/lib/active_storage/previewer/poppler_pdf_previewer.rb +2 -2
 - data/lib/active_storage/previewer/video_previewer.rb +5 -3
 - data/lib/active_storage/previewer.rb +13 -3
 - data/lib/active_storage/service/azure_storage_service.rb +40 -35
 - data/lib/active_storage/service/configurator.rb +3 -1
 - data/lib/active_storage/service/disk_service.rb +36 -31
 - data/lib/active_storage/service/gcs_service.rb +18 -16
 - data/lib/active_storage/service/mirror_service.rb +31 -7
 - data/lib/active_storage/service/registry.rb +32 -0
 - data/lib/active_storage/service/s3_service.rb +51 -23
 - data/lib/active_storage/service.rb +35 -7
 - data/lib/active_storage/transformers/image_processing_transformer.rb +21 -308
 - data/lib/active_storage/transformers/transformer.rb +0 -3
 - data/lib/active_storage.rb +301 -7
 - data/lib/tasks/activestorage.rake +5 -1
 - metadata +54 -17
 - data/db/update_migrate/20180723000244_add_foreign_key_constraint_to_active_storage_attachments_for_blob_id.rb +0 -9
 - data/lib/active_storage/downloading.rb +0 -47
 - data/lib/active_storage/transformers/mini_magick_transformer.rb +0 -38
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 26da54c9eadb4be0027c342697cdda5b3e2db9f81af78f730d00d1b6755af62e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: fb5a9b64bfaffbd8071469d8c6910f98bddb41a809917e7a405af2b87911bd58
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 81846b05d474d776edf5d7d169847e9b2e5299d0667c023e09450767323635591682ad7f6289c4cdec02d6927d24e4ddbed7e1e6064e83f2cac9e7d2a36ebd90
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 56e09dcdd851fa7fa9f08f122fa2ecc09c34265b1de2585e57c7ce985800dbb654277a77deaafb9290d9a4e8019ea08dd31f05bca668b7160b612bc9ad9e2b4f
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    | 
         @@ -1,29 +1,64 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 1 
     | 
    
         
            +
            ## Rails 6.1.7.6 (August 22, 2023) ##
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 6 
     | 
    
         
            +
            ## Rails 6.1.7.5 (August 22, 2023) ##
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 11 
     | 
    
         
            +
            ## Rails 6.1.7.4 (June 26, 2023) ##
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 16 
     | 
    
         
            +
            ## Rails 6.1.7.3 (March 13, 2023) ##
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       19 
19 
     | 
    
         | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 21 
     | 
    
         
            +
            ## Rails 6.1.7.2 (January 24, 2023) ##
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 26 
     | 
    
         
            +
            ## Rails 6.1.7.1 (January 17, 2023) ##
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            *   No changes.
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
            ## Rails 6.1.7 (September 09, 2022) ##
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            *   Respect Active Record's primary_key_type in Active Storage migrations. Backported from 7.0.
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                *fatkodima*
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            ## Rails 6.1.6.1 (July 12, 2022) ##
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            *   No changes.
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ## Rails 6.1.6 (May 09, 2022) ##
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            *   No changes.
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
             
     | 
| 
      
 47 
     | 
    
         
            +
            ## Rails 6.1.5.1 (April 26, 2022) ##
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
            *   No changes.
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            ## Rails 6.1.5 (March 09, 2022) ##
         
     | 
| 
      
 53 
     | 
    
         
            +
             
     | 
| 
      
 54 
     | 
    
         
            +
            *   Attachments can be deleted after their association is no longer defined.
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
                Fixes #42514
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
                *Don Sisco*
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            ## Rails 6.1.4.7 (March 08, 2022) ##
         
     | 
| 
       27 
62 
     | 
    
         | 
| 
       28 
63 
     | 
    
         
             
            *   Added image transformation validation via configurable allow-list.
         
     | 
| 
       29 
64 
     | 
    
         | 
| 
         @@ -33,311 +68,339 @@ 
     | 
|
| 
       33 
68 
     | 
    
         
             
                [CVE-2022-21831]
         
     | 
| 
       34 
69 
     | 
    
         | 
| 
       35 
70 
     | 
    
         | 
| 
       36 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 71 
     | 
    
         
            +
            ## Rails 6.1.4.6 (February 11, 2022) ##
         
     | 
| 
       37 
72 
     | 
    
         | 
| 
       38 
73 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       39 
74 
     | 
    
         | 
| 
       40 
75 
     | 
    
         | 
| 
       41 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 76 
     | 
    
         
            +
            ## Rails 6.1.4.5 (February 11, 2022) ##
         
     | 
| 
       42 
77 
     | 
    
         | 
| 
       43 
78 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       44 
79 
     | 
    
         | 
| 
       45 
80 
     | 
    
         | 
| 
       46 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 81 
     | 
    
         
            +
            ## Rails 6.1.4.4 (December 15, 2021) ##
         
     | 
| 
       47 
82 
     | 
    
         | 
| 
       48 
83 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       49 
84 
     | 
    
         | 
| 
       50 
85 
     | 
    
         | 
| 
       51 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 86 
     | 
    
         
            +
            ## Rails 6.1.4.3 (December 14, 2021) ##
         
     | 
| 
       52 
87 
     | 
    
         | 
| 
       53 
88 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       54 
89 
     | 
    
         | 
| 
       55 
90 
     | 
    
         | 
| 
       56 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 91 
     | 
    
         
            +
            ## Rails 6.1.4.2 (December 14, 2021) ##
         
     | 
| 
       57 
92 
     | 
    
         | 
| 
       58 
93 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       59 
94 
     | 
    
         | 
| 
       60 
95 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 96 
     | 
    
         
            +
            ## Rails 6.1.4.1 (August 19, 2021) ##
         
     | 
| 
       62 
97 
     | 
    
         | 
| 
       63 
98 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       64 
99 
     | 
    
         | 
| 
       65 
100 
     | 
    
         | 
| 
       66 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 101 
     | 
    
         
            +
            ## Rails 6.1.4 (June 24, 2021) ##
         
     | 
| 
       67 
102 
     | 
    
         | 
| 
       68 
     | 
    
         
            -
            *   The  
     | 
| 
       69 
     | 
    
         
            -
                 
     | 
| 
       70 
     | 
    
         
            -
                matches the behavior of the MuPDF previewer.
         
     | 
| 
      
 103 
     | 
    
         
            +
            *   The parameters sent to `ffmpeg` for generating a video preview image are now
         
     | 
| 
      
 104 
     | 
    
         
            +
                configurable under `config.active_storage.video_preview_arguments`.
         
     | 
| 
       71 
105 
     | 
    
         | 
| 
       72 
     | 
    
         
            -
                * 
     | 
| 
      
 106 
     | 
    
         
            +
                *Brendon Muir*
         
     | 
| 
       73 
107 
     | 
    
         | 
| 
      
 108 
     | 
    
         
            +
            *   Fix Active Storage update task when running in an engine.
         
     | 
| 
       74 
109 
     | 
    
         | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
                *Justin Malčić*
         
     | 
| 
       76 
111 
     | 
    
         | 
| 
       77 
     | 
    
         
            -
            *    
     | 
| 
      
 112 
     | 
    
         
            +
            *   Don't raise an error if the mime type is not recognized.
         
     | 
| 
       78 
113 
     | 
    
         | 
| 
      
 114 
     | 
    
         
            +
                Fixes #41777.
         
     | 
| 
       79 
115 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
      
 116 
     | 
    
         
            +
                *Alex Ghiculescu*
         
     | 
| 
       81 
117 
     | 
    
         | 
| 
       82 
     | 
    
         
            -
            *    
     | 
| 
       83 
     | 
    
         
            -
                mime types data.
         
     | 
| 
       84 
     | 
    
         
            -
             
     | 
| 
       85 
     | 
    
         
            -
                *George Claghorn*
         
     | 
| 
      
 118 
     | 
    
         
            +
            *   `ActiveStorage::PreviewError` is raised when a previewer is unable to generate a preview image.
         
     | 
| 
       86 
119 
     | 
    
         | 
| 
      
 120 
     | 
    
         
            +
                *Alex Robbin*
         
     | 
| 
       87 
121 
     | 
    
         | 
| 
       88 
     | 
    
         
            -
             
     | 
| 
      
 122 
     | 
    
         
            +
            *   respond with 404 given invalid variation key when asking for representations.
         
     | 
| 
       89 
123 
     | 
    
         | 
| 
       90 
     | 
    
         
            -
            * 
     | 
| 
      
 124 
     | 
    
         
            +
                *George Claghorn*
         
     | 
| 
       91 
125 
     | 
    
         | 
| 
      
 126 
     | 
    
         
            +
            *   `Blob` creation shouldn't crash if no service selected.
         
     | 
| 
       92 
127 
     | 
    
         | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
      
 128 
     | 
    
         
            +
                *Alex Ghiculescu*
         
     | 
| 
       94 
129 
     | 
    
         | 
| 
       95 
     | 
    
         
            -
            *   No changes.
         
     | 
| 
       96 
130 
     | 
    
         | 
| 
       97 
     | 
    
         
            -
             
     | 
| 
       98 
     | 
    
         
            -
            ## Rails 6.0.3.3 (September 09, 2020) ##
         
     | 
| 
      
 131 
     | 
    
         
            +
            ## Rails 6.1.3.2 (May 05, 2021) ##
         
     | 
| 
       99 
132 
     | 
    
         | 
| 
       100 
133 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       101 
134 
     | 
    
         | 
| 
       102 
135 
     | 
    
         | 
| 
       103 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 136 
     | 
    
         
            +
            ## Rails 6.1.3.1 (March 26, 2021) ##
         
     | 
| 
       104 
137 
     | 
    
         | 
| 
       105 
     | 
    
         
            -
            * 
     | 
| 
      
 138 
     | 
    
         
            +
            *  Marcel is upgraded to version 1.0.0 to avoid a dependency on GPL-licensed
         
     | 
| 
      
 139 
     | 
    
         
            +
               mime types data.
         
     | 
| 
       106 
140 
     | 
    
         | 
| 
      
 141 
     | 
    
         
            +
               *George Claghorn*
         
     | 
| 
       107 
142 
     | 
    
         | 
| 
       108 
     | 
    
         
            -
            ## Rails 6.0.3.1 (May 18, 2020) ##
         
     | 
| 
       109 
143 
     | 
    
         | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
      
 144 
     | 
    
         
            +
            ## Rails 6.1.3 (February 17, 2021) ##
         
     | 
| 
      
 145 
     | 
    
         
            +
             
     | 
| 
      
 146 
     | 
    
         
            +
            *   No changes.
         
     | 
| 
       111 
147 
     | 
    
         | 
| 
       112 
148 
     | 
    
         | 
| 
       113 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 149 
     | 
    
         
            +
            ## Rails 6.1.2.1 (February 10, 2021) ##
         
     | 
| 
       114 
150 
     | 
    
         | 
| 
       115 
151 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       116 
152 
     | 
    
         | 
| 
       117 
153 
     | 
    
         | 
| 
       118 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 154 
     | 
    
         
            +
            ## Rails 6.1.2 (February 09, 2021) ##
         
     | 
| 
       119 
155 
     | 
    
         | 
| 
       120 
156 
     | 
    
         
             
            *   No changes.
         
     | 
| 
       121 
157 
     | 
    
         | 
| 
       122 
158 
     | 
    
         | 
| 
       123 
     | 
    
         
            -
            ## Rails 6. 
     | 
| 
      
 159 
     | 
    
         
            +
            ## Rails 6.1.1 (January 07, 2021) ##
         
     | 
| 
       124 
160 
     | 
    
         | 
| 
       125 
     | 
    
         
            -
            *    
     | 
| 
      
 161 
     | 
    
         
            +
            *   Fix S3 multipart uploads when threshold is larger than file.
         
     | 
| 
       126 
162 
     | 
    
         | 
| 
      
 163 
     | 
    
         
            +
                *Matt Muller*
         
     | 
| 
       127 
164 
     | 
    
         | 
| 
       128 
     | 
    
         
            -
            ## Rails 6.0.2 (December 13, 2019) ##
         
     | 
| 
       129 
165 
     | 
    
         | 
| 
       130 
     | 
    
         
            -
             
     | 
| 
      
 166 
     | 
    
         
            +
            ## Rails 6.1.0 (December 09, 2020) ##
         
     | 
| 
       131 
167 
     | 
    
         | 
| 
      
 168 
     | 
    
         
            +
            *   Change default queue name of the analysis (`:active_storage_analysis`) and
         
     | 
| 
      
 169 
     | 
    
         
            +
                purge (`:active_storage_purge`) jobs to be the job adapter's default (`:default`).
         
     | 
| 
       132 
170 
     | 
    
         | 
| 
       133 
     | 
    
         
            -
             
     | 
| 
      
 171 
     | 
    
         
            +
                *Rafael Mendonça França*
         
     | 
| 
       134 
172 
     | 
    
         | 
| 
       135 
     | 
    
         
            -
            *   ` 
     | 
| 
      
 173 
     | 
    
         
            +
            *   Implement `strict_loading` on ActiveStorage associations.
         
     | 
| 
       136 
174 
     | 
    
         | 
| 
       137 
     | 
    
         
            -
                * 
     | 
| 
      
 175 
     | 
    
         
            +
                *David Angulo*
         
     | 
| 
       138 
176 
     | 
    
         | 
| 
       139 
     | 
    
         
            -
            *    
     | 
| 
       140 
     | 
    
         
            -
                This fixes that generated blob keys could silently collide, leading to
         
     | 
| 
       141 
     | 
    
         
            -
                data loss.
         
     | 
| 
      
 177 
     | 
    
         
            +
            *   Remove deprecated support to pass `:combine_options` operations to `ActiveStorage::Transformers::ImageProcessing`.
         
     | 
| 
       142 
178 
     | 
    
         | 
| 
       143 
     | 
    
         
            -
                * 
     | 
| 
      
 179 
     | 
    
         
            +
                *Rafael Mendonça França*
         
     | 
| 
       144 
180 
     | 
    
         | 
| 
      
 181 
     | 
    
         
            +
            *   Remove deprecated `ActiveStorage::Transformers::MiniMagickTransformer`.
         
     | 
| 
       145 
182 
     | 
    
         | 
| 
       146 
     | 
    
         
            -
             
     | 
| 
      
 183 
     | 
    
         
            +
                *Rafael Mendonça França*
         
     | 
| 
       147 
184 
     | 
    
         | 
| 
       148 
     | 
    
         
            -
            *    
     | 
| 
      
 185 
     | 
    
         
            +
            *   Remove deprecated `config.active_storage.queue`.
         
     | 
| 
       149 
186 
     | 
    
         | 
| 
      
 187 
     | 
    
         
            +
                *Rafael Mendonça França*
         
     | 
| 
       150 
188 
     | 
    
         | 
| 
       151 
     | 
    
         
            -
             
     | 
| 
      
 189 
     | 
    
         
            +
            *   Remove deprecated `ActiveStorage::Downloading`.
         
     | 
| 
       152 
190 
     | 
    
         | 
| 
       153 
     | 
    
         
            -
            * 
     | 
| 
      
 191 
     | 
    
         
            +
                *Rafael Mendonça França*
         
     | 
| 
       154 
192 
     | 
    
         | 
| 
      
 193 
     | 
    
         
            +
            *   Add per-environment configuration support
         
     | 
| 
       155 
194 
     | 
    
         | 
| 
       156 
     | 
    
         
            -
             
     | 
| 
      
 195 
     | 
    
         
            +
                *Pietro Moro*
         
     | 
| 
       157 
196 
     | 
    
         | 
| 
       158 
     | 
    
         
            -
            *    
     | 
| 
      
 197 
     | 
    
         
            +
            *   The Poppler PDF previewer renders a preview image using the original
         
     | 
| 
      
 198 
     | 
    
         
            +
                document's crop box rather than its media box, hiding print margins. This
         
     | 
| 
      
 199 
     | 
    
         
            +
                matches the behavior of the MuPDF previewer.
         
     | 
| 
       159 
200 
     | 
    
         | 
| 
       160 
     | 
    
         
            -
                 
     | 
| 
      
 201 
     | 
    
         
            +
                *Vincent Robert*
         
     | 
| 
       161 
202 
     | 
    
         | 
| 
       162 
     | 
    
         
            -
             
     | 
| 
      
 203 
     | 
    
         
            +
            *   Touch parent model when an attachment is purged.
         
     | 
| 
       163 
204 
     | 
    
         | 
| 
       164 
     | 
    
         
            -
            * 
     | 
| 
      
 205 
     | 
    
         
            +
                *Víctor Pérez Rodríguez*
         
     | 
| 
       165 
206 
     | 
    
         | 
| 
       166 
     | 
    
         
            -
             
     | 
| 
      
 207 
     | 
    
         
            +
            *   Files can now be served by proxying them from the underlying storage service
         
     | 
| 
      
 208 
     | 
    
         
            +
                instead of redirecting to a signed service URL. Use the
         
     | 
| 
      
 209 
     | 
    
         
            +
                `rails_storage_proxy_path` and `_url` helpers to proxy an attached file:
         
     | 
| 
       167 
210 
     | 
    
         | 
| 
      
 211 
     | 
    
         
            +
                ```erb
         
     | 
| 
      
 212 
     | 
    
         
            +
                <%= image_tag rails_storage_proxy_path(@user.avatar) %>
         
     | 
| 
      
 213 
     | 
    
         
            +
                ```
         
     | 
| 
       168 
214 
     | 
    
         | 
| 
       169 
     | 
    
         
            -
             
     | 
| 
      
 215 
     | 
    
         
            +
                To proxy by default, set `config.active_storage.resolve_model_to_route`:
         
     | 
| 
       170 
216 
     | 
    
         | 
| 
       171 
     | 
    
         
            -
             
     | 
| 
      
 217 
     | 
    
         
            +
                ```ruby
         
     | 
| 
      
 218 
     | 
    
         
            +
                # Proxy attached files instead.
         
     | 
| 
      
 219 
     | 
    
         
            +
                config.active_storage.resolve_model_to_route = :rails_storage_proxy
         
     | 
| 
      
 220 
     | 
    
         
            +
                ```
         
     | 
| 
       172 
221 
     | 
    
         | 
| 
      
 222 
     | 
    
         
            +
                ```erb
         
     | 
| 
      
 223 
     | 
    
         
            +
                <%= image_tag @user.avatar %>
         
     | 
| 
      
 224 
     | 
    
         
            +
                ```
         
     | 
| 
       173 
225 
     | 
    
         | 
| 
       174 
     | 
    
         
            -
             
     | 
| 
      
 226 
     | 
    
         
            +
                To redirect to a signed service URL when the default file serving strategy
         
     | 
| 
      
 227 
     | 
    
         
            +
                is set to proxying, use the `rails_storage_redirect_path` and `_url` helpers:
         
     | 
| 
       175 
228 
     | 
    
         | 
| 
       176 
     | 
    
         
            -
             
     | 
| 
      
 229 
     | 
    
         
            +
                ```erb
         
     | 
| 
      
 230 
     | 
    
         
            +
                <%= image_tag rails_storage_redirect_path(@user.avatar) %>
         
     | 
| 
      
 231 
     | 
    
         
            +
                ```
         
     | 
| 
       177 
232 
     | 
    
         | 
| 
      
 233 
     | 
    
         
            +
                *Jonathan Fleckenstein*
         
     | 
| 
       178 
234 
     | 
    
         | 
| 
       179 
     | 
    
         
            -
             
     | 
| 
      
 235 
     | 
    
         
            +
            *   Add `config.active_storage.web_image_content_types` to allow applications
         
     | 
| 
      
 236 
     | 
    
         
            +
                to add content types (like `image/webp`) in which variants can be processed,
         
     | 
| 
      
 237 
     | 
    
         
            +
                instead of letting those images be converted to the fallback PNG format.
         
     | 
| 
       180 
238 
     | 
    
         | 
| 
       181 
     | 
    
         
            -
            * 
     | 
| 
       182 
     | 
    
         
            -
                [`activestorage`](https://www.npmjs.com/package/activestorage) to
         
     | 
| 
       183 
     | 
    
         
            -
                [`@rails/activestorage`](https://www.npmjs.com/package/@rails/activestorage).
         
     | 
| 
      
 239 
     | 
    
         
            +
                *Jeroen van Haperen*
         
     | 
| 
       184 
240 
     | 
    
         | 
| 
       185 
     | 
    
         
            -
             
     | 
| 
      
 241 
     | 
    
         
            +
            *   Add support for creating variants of `WebP` images out of the box.
         
     | 
| 
       186 
242 
     | 
    
         | 
| 
       187 
     | 
    
         
            -
            * 
     | 
| 
       188 
     | 
    
         
            -
                queues analysis and purge jobs should use, respectively:
         
     | 
| 
      
 243 
     | 
    
         
            +
                *Dino Maric*
         
     | 
| 
       189 
244 
     | 
    
         | 
| 
       190 
     | 
    
         
            -
             
     | 
| 
       191 
     | 
    
         
            -
                * `config.active_storage.queues.purge`
         
     | 
| 
      
 245 
     | 
    
         
            +
            *   Only enqueue analysis jobs for blobs with non-null analyzer classes.
         
     | 
| 
       192 
246 
     | 
    
         | 
| 
       193 
     | 
    
         
            -
                 
     | 
| 
       194 
     | 
    
         
            -
                set, but it is deprecated and will be removed in Rails 6.1.
         
     | 
| 
      
 247 
     | 
    
         
            +
                *Gannon McGibbon*
         
     | 
| 
       195 
248 
     | 
    
         | 
| 
       196 
     | 
    
         
            -
             
     | 
| 
      
 249 
     | 
    
         
            +
            *   Previews are created on the same service as the original blob.
         
     | 
| 
       197 
250 
     | 
    
         | 
| 
       198 
     | 
    
         
            -
            * 
     | 
| 
      
 251 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       199 
252 
     | 
    
         | 
| 
       200 
     | 
    
         
            -
             
     | 
| 
      
 253 
     | 
    
         
            +
            *   Remove unused `disposition` and `content_type` query parameters for `DiskService`.
         
     | 
| 
       201 
254 
     | 
    
         | 
| 
       202 
     | 
    
         
            -
            * 
     | 
| 
       203 
     | 
    
         
            -
                collisions and undefined behavior with case-insensitive filesystems and
         
     | 
| 
       204 
     | 
    
         
            -
                database indices.
         
     | 
| 
      
 255 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       205 
256 
     | 
    
         | 
| 
       206 
     | 
    
         
            -
             
     | 
| 
      
 257 
     | 
    
         
            +
            *   Use `DiskController` for both public and private files.
         
     | 
| 
       207 
258 
     | 
    
         | 
| 
       208 
     | 
    
         
            -
             
     | 
| 
       209 
     | 
    
         
            -
                 
     | 
| 
      
 259 
     | 
    
         
            +
                `DiskController` is able to handle multiple services by adding a
         
     | 
| 
      
 260 
     | 
    
         
            +
                `service_name` field in the generated URL in `DiskService`.
         
     | 
| 
       210 
261 
     | 
    
         | 
| 
       211 
     | 
    
         
            -
                * 
     | 
| 
      
 262 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       212 
263 
     | 
    
         | 
| 
       213 
     | 
    
         
            -
            *    
     | 
| 
      
 264 
     | 
    
         
            +
            *   Variants are tracked in the database to avoid existence checks in the storage service.
         
     | 
| 
       214 
265 
     | 
    
         | 
| 
       215 
     | 
    
         
            -
                * 
     | 
| 
      
 266 
     | 
    
         
            +
                *George Claghorn*
         
     | 
| 
       216 
267 
     | 
    
         | 
| 
       217 
     | 
    
         
            -
            *    
     | 
| 
      
 268 
     | 
    
         
            +
            *   Deprecate `service_url` methods in favour of `url`.
         
     | 
| 
       218 
269 
     | 
    
         | 
| 
       219 
     | 
    
         
            -
                 
     | 
| 
      
 270 
     | 
    
         
            +
                Deprecate `Variant#service_url` and `Preview#service_url` to instead use
         
     | 
| 
      
 271 
     | 
    
         
            +
                `#url` method to be consistent with `Blob`.
         
     | 
| 
       220 
272 
     | 
    
         | 
| 
       221 
     | 
    
         
            -
            * 
     | 
| 
      
 273 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       222 
274 
     | 
    
         | 
| 
       223 
     | 
    
         
            -
             
     | 
| 
      
 275 
     | 
    
         
            +
            *   Permanent URLs for public storage blobs.
         
     | 
| 
       224 
276 
     | 
    
         | 
| 
       225 
     | 
    
         
            -
             
     | 
| 
       226 
     | 
    
         
            -
                 
     | 
| 
       227 
     | 
    
         
            -
                 
     | 
| 
       228 
     | 
    
         
            -
                exception class.
         
     | 
| 
      
 277 
     | 
    
         
            +
                Services can be configured in `config/storage.yml` with a new key
         
     | 
| 
      
 278 
     | 
    
         
            +
                `public: true | false` to indicate whether a service holds public
         
     | 
| 
      
 279 
     | 
    
         
            +
                blobs or private blobs. Public services will always return a permanent URL.
         
     | 
| 
       229 
280 
     | 
    
         | 
| 
       230 
     | 
    
         
            -
                 
     | 
| 
      
 281 
     | 
    
         
            +
                Deprecates `Blob#service_url` in favor of `Blob#url`.
         
     | 
| 
       231 
282 
     | 
    
         | 
| 
       232 
     | 
    
         
            -
            * 
     | 
| 
       233 
     | 
    
         
            -
                the requested file is missing from the disk service. It previously raised
         
     | 
| 
       234 
     | 
    
         
            -
                `Errno::ENOENT`.
         
     | 
| 
      
 283 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       235 
284 
     | 
    
         | 
| 
       236 
     | 
    
         
            -
             
     | 
| 
      
 285 
     | 
    
         
            +
            *   Make services aware of configuration names.
         
     | 
| 
       237 
286 
     | 
    
         | 
| 
       238 
     | 
    
         
            -
            * 
     | 
| 
       239 
     | 
    
         
            -
                `ActiveStorage::FileNotFoundError` when the corresponding file is missing
         
     | 
| 
       240 
     | 
    
         
            -
                from the storage service. Services translate service-specific missing object
         
     | 
| 
       241 
     | 
    
         
            -
                exceptions (e.g. `Google::Cloud::NotFoundError` for the GCS service and
         
     | 
| 
       242 
     | 
    
         
            -
                `Errno::ENOENT` for the disk service) into
         
     | 
| 
       243 
     | 
    
         
            -
                `ActiveStorage::FileNotFoundError`.
         
     | 
| 
      
 287 
     | 
    
         
            +
                *Gannon McGibbon*
         
     | 
| 
       244 
288 
     | 
    
         | 
| 
       245 
     | 
    
         
            -
             
     | 
| 
      
 289 
     | 
    
         
            +
            *   The `Content-Type` header is set on image variants when they're uploaded to third-party storage services.
         
     | 
| 
       246 
290 
     | 
    
         | 
| 
       247 
     | 
    
         
            -
            * 
     | 
| 
       248 
     | 
    
         
            -
                controllers that can't inherit from `ActiveStorage::BaseController`.
         
     | 
| 
      
 291 
     | 
    
         
            +
                *Kyle Ribordy*
         
     | 
| 
       249 
292 
     | 
    
         | 
| 
       250 
     | 
    
         
            -
             
     | 
| 
      
 293 
     | 
    
         
            +
            *   Allow storage services to be configured per attachment.
         
     | 
| 
       251 
294 
     | 
    
         | 
| 
       252 
     | 
    
         
            -
             
     | 
| 
       253 
     | 
    
         
            -
                 
     | 
| 
       254 
     | 
    
         
            -
             
     | 
| 
       255 
     | 
    
         
            -
                 
     | 
| 
      
 295 
     | 
    
         
            +
                ```ruby
         
     | 
| 
      
 296 
     | 
    
         
            +
                class User < ActiveRecord::Base
         
     | 
| 
      
 297 
     | 
    
         
            +
                  has_one_attached :avatar, service: :s3
         
     | 
| 
      
 298 
     | 
    
         
            +
                end
         
     | 
| 
       256 
299 
     | 
    
         | 
| 
       257 
     | 
    
         
            -
                 
     | 
| 
      
 300 
     | 
    
         
            +
                class Gallery < ActiveRecord::Base
         
     | 
| 
      
 301 
     | 
    
         
            +
                  has_many_attached :photos, service: :s3
         
     | 
| 
      
 302 
     | 
    
         
            +
                end
         
     | 
| 
      
 303 
     | 
    
         
            +
                ```
         
     | 
| 
       258 
304 
     | 
    
         | 
| 
       259 
     | 
    
         
            -
            * 
     | 
| 
       260 
     | 
    
         
            -
                is saved instead of immediately.
         
     | 
| 
      
 305 
     | 
    
         
            +
                *Dmitry Tsepelev*
         
     | 
| 
       261 
306 
     | 
    
         | 
| 
       262 
     | 
    
         
            -
             
     | 
| 
       263 
     | 
    
         
            -
                be stored:
         
     | 
| 
      
 307 
     | 
    
         
            +
            *   You can optionally provide a custom blob key when attaching a new file:
         
     | 
| 
       264 
308 
     | 
    
         | 
| 
       265 
309 
     | 
    
         
             
                ```ruby
         
     | 
| 
       266 
     | 
    
         
            -
                 
     | 
| 
      
 310 
     | 
    
         
            +
                user.avatar.attach key: "avatars/#{user.id}.jpg",
         
     | 
| 
      
 311 
     | 
    
         
            +
                  io: io, content_type: "image/jpeg", filename: "avatar.jpg"
         
     | 
| 
       267 
312 
     | 
    
         
             
                ```
         
     | 
| 
       268 
313 
     | 
    
         | 
| 
       269 
     | 
    
         
            -
                 
     | 
| 
      
 314 
     | 
    
         
            +
                Active Storage will store the blob's data on the configured service at the provided key.
         
     | 
| 
       270 
315 
     | 
    
         | 
| 
       271 
316 
     | 
    
         
             
                *George Claghorn*
         
     | 
| 
       272 
317 
     | 
    
         | 
| 
       273 
     | 
    
         
            -
            *    
     | 
| 
       274 
     | 
    
         
            -
                ActiveRecord reflection mechanism.
         
     | 
| 
      
 318 
     | 
    
         
            +
            *   Replace `Blob.create_after_upload!` with `Blob.create_and_upload!` and deprecate the former.
         
     | 
| 
       275 
319 
     | 
    
         | 
| 
       276 
     | 
    
         
            -
                 
     | 
| 
      
 320 
     | 
    
         
            +
                `create_after_upload!` has been removed since it could lead to data
         
     | 
| 
      
 321 
     | 
    
         
            +
                corruption by uploading to a key on the storage service which happened to
         
     | 
| 
      
 322 
     | 
    
         
            +
                be already taken. Creating the record would then correctly raise a
         
     | 
| 
      
 323 
     | 
    
         
            +
                database uniqueness exception but the stored object would already have
         
     | 
| 
      
 324 
     | 
    
         
            +
                overwritten another. `create_and_upload!` swaps the order of operations
         
     | 
| 
      
 325 
     | 
    
         
            +
                so that the key gets reserved up-front or the uniqueness error gets raised,
         
     | 
| 
      
 326 
     | 
    
         
            +
                before the upload to a key takes place.
         
     | 
| 
       277 
327 
     | 
    
         | 
| 
       278 
     | 
    
         
            -
            * 
     | 
| 
       279 
     | 
    
         
            -
                processor. For example, the following will not have the monochrome
         
     | 
| 
       280 
     | 
    
         
            -
                variation applied:
         
     | 
| 
      
 328 
     | 
    
         
            +
                *Julik Tarkhanov*
         
     | 
| 
       281 
329 
     | 
    
         | 
| 
       282 
     | 
    
         
            -
             
     | 
| 
       283 
     | 
    
         
            -
                  avatar.variant(monochrome: false)
         
     | 
| 
       284 
     | 
    
         
            -
                ```
         
     | 
| 
      
 330 
     | 
    
         
            +
            *   Set content disposition in direct upload using `filename` and `disposition` parameters to `ActiveStorage::Service#headers_for_direct_upload`.
         
     | 
| 
       285 
331 
     | 
    
         | 
| 
       286 
     | 
    
         
            -
                * 
     | 
| 
      
 332 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       287 
333 
     | 
    
         | 
| 
       288 
     | 
    
         
            -
            *    
     | 
| 
       289 
     | 
    
         
            -
                 
     | 
| 
       290 
     | 
    
         
            -
                allow overriding and composition using `super`.
         
     | 
| 
      
 334 
     | 
    
         
            +
            *   Allow record to be optionally passed to blob finders to make sharding
         
     | 
| 
      
 335 
     | 
    
         
            +
                easier.
         
     | 
| 
       291 
336 
     | 
    
         | 
| 
       292 
     | 
    
         
            -
                * 
     | 
| 
      
 337 
     | 
    
         
            +
                *Gannon McGibbon*
         
     | 
| 
       293 
338 
     | 
    
         | 
| 
       294 
     | 
    
         
            -
            *    
     | 
| 
       295 
     | 
    
         
            -
                and yields the tempfile. Deprecate `ActiveStorage::Downloading`.
         
     | 
| 
      
 339 
     | 
    
         
            +
            *   Switch from `azure-storage` gem to `azure-storage-blob` gem for Azure service.
         
     | 
| 
       296 
340 
     | 
    
         | 
| 
       297 
     | 
    
         
            -
                * 
     | 
| 
      
 341 
     | 
    
         
            +
                *Peter Zhu*
         
     | 
| 
       298 
342 
     | 
    
         | 
| 
       299 
     | 
    
         
            -
            *    
     | 
| 
       300 
     | 
    
         
            -
                `ActiveStorage::Attached::{One,Many}#attach` to bypass automatic content
         
     | 
| 
       301 
     | 
    
         
            -
                type inference. For example:
         
     | 
| 
      
 343 
     | 
    
         
            +
            *   Add `config.active_storage.draw_routes` to disable Active Storage routes.
         
     | 
| 
       302 
344 
     | 
    
         | 
| 
       303 
     | 
    
         
            -
                 
     | 
| 
       304 
     | 
    
         
            -
                  @message.image.attach(
         
     | 
| 
       305 
     | 
    
         
            -
                    io: File.open('/path/to/file'),
         
     | 
| 
       306 
     | 
    
         
            -
                    filename: 'file.pdf',
         
     | 
| 
       307 
     | 
    
         
            -
                    content_type: 'application/pdf',
         
     | 
| 
       308 
     | 
    
         
            -
                    identify: false
         
     | 
| 
       309 
     | 
    
         
            -
                  )
         
     | 
| 
       310 
     | 
    
         
            -
                ```
         
     | 
| 
      
 345 
     | 
    
         
            +
                *Gannon McGibbon*
         
     | 
| 
       311 
346 
     | 
    
         | 
| 
       312 
     | 
    
         
            -
             
     | 
| 
      
 347 
     | 
    
         
            +
            *   Image analysis is skipped if ImageMagick returns an error.
         
     | 
| 
       313 
348 
     | 
    
         | 
| 
       314 
     | 
    
         
            -
             
     | 
| 
       315 
     | 
    
         
            -
                 
     | 
| 
      
 349 
     | 
    
         
            +
                `ActiveStorage::Analyzer::ImageAnalyzer#metadata` would previously raise a
         
     | 
| 
      
 350 
     | 
    
         
            +
                `MiniMagick::Error`, which caused persistent `ActiveStorage::AnalyzeJob`
         
     | 
| 
      
 351 
     | 
    
         
            +
                failures. It now logs the error and returns `{}`, resulting in no metadata
         
     | 
| 
      
 352 
     | 
    
         
            +
                being added to the offending image blob.
         
     | 
| 
       316 
353 
     | 
    
         | 
| 
       317 
354 
     | 
    
         
             
                *George Claghorn*
         
     | 
| 
       318 
355 
     | 
    
         | 
| 
       319 
     | 
    
         
            -
            *    
     | 
| 
       320 
     | 
    
         
            -
                for Active Storage variants, and deprecate the MiniMagick backend.
         
     | 
| 
      
 356 
     | 
    
         
            +
            *   Method calls on singular attachments return `nil` when no file is attached.
         
     | 
| 
       321 
357 
     | 
    
         | 
| 
       322 
     | 
    
         
            -
                 
     | 
| 
       323 
     | 
    
         
            -
                 
     | 
| 
       324 
     | 
    
         
            -
                operations, variants can now use `:resize_to_fit`, `:resize_to_fill`, and
         
     | 
| 
       325 
     | 
    
         
            -
                other ImageProcessing macros. These are now recommended over raw `:resize`,
         
     | 
| 
       326 
     | 
    
         
            -
                as they also sharpen the thumbnail after resizing.
         
     | 
| 
      
 358 
     | 
    
         
            +
                Previously, assuming the following User model, `user.avatar.filename` would
         
     | 
| 
      
 359 
     | 
    
         
            +
                raise a `Module::DelegationError` if no avatar was attached:
         
     | 
| 
       327 
360 
     | 
    
         | 
| 
       328 
     | 
    
         
            -
                 
     | 
| 
       329 
     | 
    
         
            -
                 
     | 
| 
       330 
     | 
    
         
            -
             
     | 
| 
       331 
     | 
    
         
            -
                 
     | 
| 
       332 
     | 
    
         
            -
                 
     | 
| 
       333 
     | 
    
         
            -
             
     | 
| 
       334 
     | 
    
         
            -
                 
     | 
| 
      
 361 
     | 
    
         
            +
                ```ruby
         
     | 
| 
      
 362 
     | 
    
         
            +
                class User < ApplicationRecord
         
     | 
| 
      
 363 
     | 
    
         
            +
                  has_one_attached :avatar
         
     | 
| 
      
 364 
     | 
    
         
            +
                end
         
     | 
| 
      
 365 
     | 
    
         
            +
                ```
         
     | 
| 
      
 366 
     | 
    
         
            +
             
     | 
| 
      
 367 
     | 
    
         
            +
                They now return `nil`.
         
     | 
| 
      
 368 
     | 
    
         
            +
             
     | 
| 
      
 369 
     | 
    
         
            +
                *Matthew Tanous*
         
     | 
| 
       335 
370 
     | 
    
         | 
| 
       336 
     | 
    
         
            -
             
     | 
| 
      
 371 
     | 
    
         
            +
            *   The mirror service supports direct uploads.
         
     | 
| 
       337 
372 
     | 
    
         | 
| 
       338 
     | 
    
         
            -
             
     | 
| 
      
 373 
     | 
    
         
            +
                New files are directly uploaded to the primary service. When a
         
     | 
| 
      
 374 
     | 
    
         
            +
                directly-uploaded file is attached to a record, a background job is enqueued
         
     | 
| 
      
 375 
     | 
    
         
            +
                to copy it to each secondary service.
         
     | 
| 
       339 
376 
     | 
    
         | 
| 
       340 
     | 
    
         
            -
                 
     | 
| 
      
 377 
     | 
    
         
            +
                Configure the queue used to process mirroring jobs by setting
         
     | 
| 
      
 378 
     | 
    
         
            +
                `config.active_storage.queues.mirror`. The default is `:active_storage_mirror`.
         
     | 
| 
      
 379 
     | 
    
         
            +
             
     | 
| 
      
 380 
     | 
    
         
            +
                *George Claghorn*
         
     | 
| 
      
 381 
     | 
    
         
            +
             
     | 
| 
      
 382 
     | 
    
         
            +
            *   The S3 service now permits uploading files larger than 5 gigabytes.
         
     | 
| 
      
 383 
     | 
    
         
            +
             
     | 
| 
      
 384 
     | 
    
         
            +
                When uploading a file greater than 100 megabytes in size, the service
         
     | 
| 
      
 385 
     | 
    
         
            +
                transparently switches to [multipart uploads](https://docs.aws.amazon.com/AmazonS3/latest/dev/mpuoverview.html)
         
     | 
| 
      
 386 
     | 
    
         
            +
                using a part size computed from the file's total size and S3's part count limit.
         
     | 
| 
      
 387 
     | 
    
         
            +
             
     | 
| 
      
 388 
     | 
    
         
            +
                No application changes are necessary to take advantage of this feature. You
         
     | 
| 
      
 389 
     | 
    
         
            +
                can customize the default 100 MB multipart upload threshold in your S3
         
     | 
| 
      
 390 
     | 
    
         
            +
                service's configuration:
         
     | 
| 
      
 391 
     | 
    
         
            +
             
     | 
| 
      
 392 
     | 
    
         
            +
                ```yaml
         
     | 
| 
      
 393 
     | 
    
         
            +
                production:
         
     | 
| 
      
 394 
     | 
    
         
            +
                  service: s3
         
     | 
| 
      
 395 
     | 
    
         
            +
                  access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
         
     | 
| 
      
 396 
     | 
    
         
            +
                  secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
         
     | 
| 
      
 397 
     | 
    
         
            +
                  region: us-east-1
         
     | 
| 
      
 398 
     | 
    
         
            +
                  bucket: my-bucket
         
     | 
| 
      
 399 
     | 
    
         
            +
                  upload:
         
     | 
| 
      
 400 
     | 
    
         
            +
                    multipart_threshold: <%= 250.megabytes %>
         
     | 
| 
      
 401 
     | 
    
         
            +
                ```
         
     | 
| 
      
 402 
     | 
    
         
            +
             
     | 
| 
      
 403 
     | 
    
         
            +
                *George Claghorn*
         
     | 
| 
       341 
404 
     | 
    
         | 
| 
       342 
405 
     | 
    
         | 
| 
       343 
     | 
    
         
            -
            Please check [ 
     | 
| 
      
 406 
     | 
    
         
            +
            Please check [6-0-stable](https://github.com/rails/rails/blob/6-0-stable/activestorage/CHANGELOG.md) for previous changes.
         
     | 
    
        data/MIT-LICENSE
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -16,7 +16,7 @@ A key difference to how Active Storage works compared to other attachment soluti 
     | 
|
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
            ## Installation
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
            Run `rails active_storage:install` to copy over active_storage migrations.
         
     | 
| 
      
 19 
     | 
    
         
            +
            Run `bin/rails active_storage:install` to copy over active_storage migrations.
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
            NOTE: If the task cannot be found, verify that `require "active_storage/engine"` is present in `config/application.rb`.
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
         @@ -55,7 +55,7 @@ url_for(user.avatar) 
     | 
|
| 
       55 
55 
     | 
    
         | 
| 
       56 
56 
     | 
    
         
             
            class AvatarsController < ApplicationController
         
     | 
| 
       57 
57 
     | 
    
         
             
              def update
         
     | 
| 
       58 
     | 
    
         
            -
                # params[:avatar] contains  
     | 
| 
      
 58 
     | 
    
         
            +
                # params[:avatar] contains an ActionDispatch::Http::UploadedFile object
         
     | 
| 
       59 
59 
     | 
    
         
             
                Current.user.avatar.attach(params.require(:avatar))
         
     | 
| 
       60 
60 
     | 
    
         
             
                redirect_to Current.user
         
     | 
| 
       61 
61 
     | 
    
         
             
              end
         
     | 
| 
         @@ -106,6 +106,37 @@ Variation of image attachment: 
     | 
|
| 
       106 
106 
     | 
    
         
             
            <%= image_tag user.avatar.variant(resize_to_limit: [100, 100]) %>
         
     | 
| 
       107 
107 
     | 
    
         
             
            ```
         
     | 
| 
       108 
108 
     | 
    
         | 
| 
      
 109 
     | 
    
         
            +
            ## File serving strategies
         
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
            Active Storage supports two ways to serve files: redirecting and proxying.
         
     | 
| 
      
 112 
     | 
    
         
            +
             
     | 
| 
      
 113 
     | 
    
         
            +
            ### Redirecting
         
     | 
| 
      
 114 
     | 
    
         
            +
             
     | 
| 
      
 115 
     | 
    
         
            +
            Active Storage generates stable application URLs for files which, when accessed, redirect to signed, short-lived service URLs. This relieves application servers of the burden of serving file data. It is the default file serving strategy.
         
     | 
| 
      
 116 
     | 
    
         
            +
             
     | 
| 
      
 117 
     | 
    
         
            +
            When the application is configured to proxy files by default, use the `rails_storage_redirect_path` and `_url` route helpers to redirect instead:
         
     | 
| 
      
 118 
     | 
    
         
            +
             
     | 
| 
      
 119 
     | 
    
         
            +
            ```erb
         
     | 
| 
      
 120 
     | 
    
         
            +
            <%= image_tag rails_storage_redirect_path(@user.avatar) %>
         
     | 
| 
      
 121 
     | 
    
         
            +
            ```
         
     | 
| 
      
 122 
     | 
    
         
            +
             
     | 
| 
      
 123 
     | 
    
         
            +
            ### Proxying
         
     | 
| 
      
 124 
     | 
    
         
            +
             
     | 
| 
      
 125 
     | 
    
         
            +
            Optionally, files can be proxied instead. This means that your application servers will download file data from the storage service in response to requests. This can be useful for serving files from a CDN.
         
     | 
| 
      
 126 
     | 
    
         
            +
             
     | 
| 
      
 127 
     | 
    
         
            +
            Explicitly proxy attachments using the `rails_storage_proxy_path` and `_url` route helpers:
         
     | 
| 
      
 128 
     | 
    
         
            +
             
     | 
| 
      
 129 
     | 
    
         
            +
            ```erb
         
     | 
| 
      
 130 
     | 
    
         
            +
            <%= image_tag rails_storage_proxy_path(@user.avatar) %>
         
     | 
| 
      
 131 
     | 
    
         
            +
            ```
         
     | 
| 
      
 132 
     | 
    
         
            +
             
     | 
| 
      
 133 
     | 
    
         
            +
            Or configure Active Storage to use proxying by default:
         
     | 
| 
      
 134 
     | 
    
         
            +
             
     | 
| 
      
 135 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 136 
     | 
    
         
            +
            # config/initializers/active_storage.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            Rails.application.config.active_storage.resolve_model_to_route = :rails_storage_proxy
         
     | 
| 
      
 138 
     | 
    
         
            +
            ```
         
     | 
| 
      
 139 
     | 
    
         
            +
             
     | 
| 
       109 
140 
     | 
    
         
             
            ## Direct uploads
         
     | 
| 
       110 
141 
     | 
    
         | 
| 
       111 
142 
     | 
    
         
             
            Active Storage, with its included JavaScript library, supports uploading directly from the client to the cloud.
         
     | 
| 
         @@ -120,7 +151,8 @@ Active Storage, with its included JavaScript library, supports uploading directl 
     | 
|
| 
       120 
151 
     | 
    
         
             
                ```
         
     | 
| 
       121 
152 
     | 
    
         
             
                Using the npm package:
         
     | 
| 
       122 
153 
     | 
    
         
             
                ```js
         
     | 
| 
       123 
     | 
    
         
            -
                 
     | 
| 
      
 154 
     | 
    
         
            +
                import * as ActiveStorage from "@rails/activestorage"
         
     | 
| 
      
 155 
     | 
    
         
            +
                ActiveStorage.start()
         
     | 
| 
       124 
156 
     | 
    
         
             
                ```
         
     | 
| 
       125 
157 
     | 
    
         
             
            2. Annotate file inputs with the direct upload URL.
         
     | 
| 
       126 
158 
     | 
    
         |