Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
8f7f29f
Fix condition to include Schema, using 'ActiveRecord::Base' instead o…
tonidas Nov 21, 2015
134b7b4
fix S3 adapter runtime constant definition not being thread-safe
erkki Nov 30, 2015
11e4a63
remove unused block
erkki Nov 30, 2015
81423af
double quotes as per hound feedback
erkki Nov 30, 2015
0167bf2
Remove duplication by reusing existing method.
airblade Nov 10, 2015
358e477
Merge pull request #2045 from airblade/refactor-s3
tute Dec 2, 2015
8c53779
Merge pull request #2060 from tonidas/master
tute Dec 2, 2015
0b73776
Remove locales from main repository
tute Sep 9, 2015
850a199
Merge pull request #1996 from thoughtbot/tc-translations
tute Dec 2, 2015
a4e14fb
Removes Rails 3.2 and 4.1 support
tute Dec 22, 2015
2fe81fb
Merge pull request #2074 from thoughtbot/tc-remove-unsupported-rails
tute Dec 22, 2015
d570f1e
Remove AWS v1 support
tute Dec 22, 2015
d55b445
Simplify S3 file. Doesn't need v1 branches.
tute Dec 22, 2015
76f825a
Merge pull request #2075 from thoughtbot/tc-remove-aws-v1
tute Dec 23, 2015
51ed136
Remove unused vars `column_(type|options)` from `remove_attachment` m…
keram Jan 2, 2016
e384ccd
Replace File.exists? with File.exist? in paperclip.gemspec
keram Jan 2, 2016
c373542
Merge pull request #2083 from keram/file_exist
maclover7 Jan 3, 2016
72b4603
Merge pull request #2082 from keram/remove_unused_vars
maclover7 Jan 3, 2016
c31cd64
Update copyright notices to 2016 [ci skip]
Atul9 Jan 1, 2016
4b5a364
Merge pull request #2084 from Atul9/master
maclover7 Jan 3, 2016
cf8aa91
Relax mimemagic version constraint to ~> 0.3.0
jaredbeck Jan 4, 2016
06d5efc
Merge pull request #2085 from jaredbeck/allow_mimemagic.0.3.1
maclover7 Jan 13, 2016
f0bd25a
Modify the Gemfile for testing with mime-types 3
halostatue Nov 23, 2015
8667baa
Merge pull request #2061 from halostatue/allow-mime-types-3
maclover7 Jan 14, 2016
53a386c
Skip calculating fingerprint when it is not used
mattbrictson Jan 15, 2016
bd01600
Merge pull request #2091 from mattbrictson/lazy-fingerprint
maclover7 Jan 16, 2016
85d9af4
Remove attr_protected related specs (was removed in rails 4)
Jan 26, 2016
37589f9
Merge pull request #2094 from kevcha/remove-rails-3-support
maclover7 Jan 26, 2016
d7b5c59
Fix content issue
mmangino Feb 17, 2016
c38bb31
Drop support for Ruby 2.0 as it's EOLd
tute Feb 26, 2016
e60f000
Link v4.3 release notes to that branch
tute Mar 12, 2016
8e1dae7
close + unlink tempfiles in various edge conditions, add an around fi…
erkki Mar 23, 2016
d577800
Merge branch 'unlink_tempfiles' into backport
erkki Mar 24, 2016
e7b6ff5
Parallel s3 upload
mmangino Apr 7, 2016
c61a646
use both mime and file type
mmangino May 26, 2016
86958b6
Reduce threading
mmangino Nov 15, 2016
f9b3067
Get rid of deprecated Thread.exclusive
jarkko Feb 7, 2017
4925569
replace URI escape with RFC2396_Parser
leifg May 4, 2021
d37ff13
Merge pull request #1 from HubTran/remove-deprecations
leifg May 4, 2021
a57384e
Use AWS SDK V3
alex-tan Oct 17, 2022
17cdc05
Allow storing s3 config in each style (for bucket so far)
mmangino Apr 27, 2023
baa43e9
Add region to style
mmangino Apr 27, 2023
e4377f7
Update to make regional optional
mmangino May 22, 2023
704e3e0
Fix
mmangino May 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
rvm:
- 2.0
- 2.1
- 2.2

script: "bundle exec rake clean spec cucumber"

gemfile:
- gemfiles/3.2.awsv2.1.gemfile
- gemfiles/4.1.awsv2.1.gemfile
- gemfiles/4.2.awsv2.1.gemfile
- gemfiles/3.2.awsv2.0.gemfile
- gemfiles/4.1.awsv2.0.gemfile
- gemfiles/4.2.awsv2.0.gemfile
- gemfiles/3.2.awsv1.gemfile
- gemfiles/4.1.awsv1.gemfile
- gemfiles/4.2.awsv1.gemfile

sudo: false
cache: bundler
43 changes: 8 additions & 35 deletions Appraisals
Original file line number Diff line number Diff line change
@@ -1,44 +1,17 @@
appraise "3.2.awsv2.1" do
gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 2.1.0"
end

appraise "4.1.awsv2.1" do
gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 2.1.0"
end

appraise "4.2.awsv2.1" do
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.1.0"
end

appraise "3.2.awsv2.0" do
gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 2.0.0"
end
gem "aws-sdk-s3", "~> 1"

appraise "4.1.awsv2.0" do
gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 2.0.0"
group :development, :test do
gem 'mime-types', '>= 1.16', '< 4'
end
end

appraise "4.2.awsv2.0" do
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 2.0.0"
end

appraise "3.2.awsv1" do
gem "rails", "~> 3.2.0"
gem "aws-sdk", "~> 1.5"
end
gem "aws-sdk-s3", "~> 1"

appraise "4.1.awsv1" do
gem "rails", "~> 4.1.0"
gem "aws-sdk", "~> 1.5"
end

appraise "4.2.awsv1" do
gem "rails", "~> 4.2.0"
gem "aws-sdk", "~> 1.5"
group :development, :test do
gem 'mime-types', '>= 1.16', '< 4'
end
end
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem 'pry'
# Prevents bundler from taking a long-time to resolve
group :development, :test do
gem 'activerecord-import'
gem 'mime-types', '~> 1.16'
gem 'mime-types'
gem 'builder'
gem 'rubocop', require: false
end
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ LICENSE

The MIT License

Copyright (c) 2008-2015 Jon Yurek and thoughtbot, inc.
Copyright (c) 2008-2016 Jon Yurek and thoughtbot, inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
11 changes: 4 additions & 7 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
master:

* Drops support to end-of-life'd ruby 2.0.
* Improvement: Paperclip now supports aws-sdk v2
@betesh, @davetchen,
https://github.com/thoughtbot/paperclip/pull/1903
Expand All @@ -9,14 +10,10 @@ master:
s3_region may be nested in s3_credentials, and (if not nested in
s3_credentials) it may be a Proc.

4.3.1 (2015-09-09):
4.3

* Backport of bugfix to `remove_column`, so it works in Rails 3 and 4
c740fb171fe2f88c60b999d2a1c2122f2b8f43e9
* Fix GeometryParser regex for usage of '@>' flag
* `url` on a unpersisted record returns default_url
* spec deprecation warnings and failures
* README adjustments
See patch versions in v4.3 NEWS:
https://github.com/thoughtbot/paperclip/blob/v4.3/NEWS

4.3.0 (2015-06-18):

Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Paperclip
- [Deleting an Attachment](#deleting-an-attachment)
- [Usage](#usage)
- [Validations](#validations)
- [Internationalization (I18n)](#internationalization-i18n)
- [Security Validations](#security-validations)
- [Defaults](#defaults)
- [Migrations](#migrations-1)
Expand Down Expand Up @@ -400,6 +401,12 @@ inferred content_type, regardless of the actual contents of the file.

---

Internationalization (I18n)
---------------------------

For using or adding locale files in different languages, check the project
https://github.com/thoughtbot/paperclip-i18n.

Security Validations
====================

Expand Down Expand Up @@ -554,7 +561,7 @@ Storage
Paperclip ships with 3 storage adapters:

* File Storage
* S3 Storage (via `aws-sdk` or `aws-sdk-v1`)
* S3 Storage (via `aws-sdk`)
* Fog Storage

If you would like to use Paperclip with another storage, you can install these
Expand Down Expand Up @@ -584,10 +591,6 @@ the `aws-sdk` gem in your Gemfile:
```ruby
gem 'aws-sdk', '>= 2.0.0' # If using paperclip `master` (upcoming v5.0)
```
or
```ruby
gem 'aws-sdk-v1' # If using paperclip <= v4.3.1
```

And then you can specify using S3 from `has_attached_file`.
You can find more information about configuring and using S3 storage in
Expand Down Expand Up @@ -967,7 +970,7 @@ Thank you to all [the contributors](https://github.com/thoughtbot/paperclip/grap
License
-------

Paperclip is Copyright © 2008-2015 thoughtbot, inc. It is free software, and may be
Paperclip is Copyright © 2008-2016 thoughtbot, inc. It is free software, and may be
redistributed under the terms specified in the MIT-LICENSE file.

About thoughtbot
Expand Down
5 changes: 0 additions & 5 deletions UPGRADING
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,3 @@ changes:
note that the format of the permissions changed from using an underscore to
using a hyphen. For example, `:public_read` needs to be changed to
`public-read`.

If you want to continue using an earlier version of aws-sdk, replace
aws-sdk with aws-sdk-v1 in your Gemfile.

If both are in your Gemfile, paperclip will use aws-sdk v2.
17 changes: 0 additions & 17 deletions gemfiles/3.2.awsv1.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/3.2.awsv2.0.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/3.2.awsv2.1.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/4.1.awsv1.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/4.1.awsv2.0.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/4.1.awsv2.1.gemfile

This file was deleted.

17 changes: 0 additions & 17 deletions gemfiles/4.2.awsv1.gemfile

This file was deleted.

2 changes: 1 addition & 1 deletion gemfiles/4.2.awsv2.0.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "aws-sdk", "~> 2.0.0"

group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16"
gem "mime-types", ">= 1.16", "< 4"
gem "builder"
gem "rubocop", :require => false
end
Expand Down
2 changes: 1 addition & 1 deletion gemfiles/4.2.awsv2.1.gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ gem "aws-sdk", "~> 2.1.0"

group :development, :test do
gem "activerecord-import"
gem "mime-types", "~> 1.16"
gem "mime-types", ">= 1.16", "< 4"
gem "builder"
gem "rubocop", :require => false
end
Expand Down
12 changes: 8 additions & 4 deletions lib/paperclip/attachment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def initialize_storage #:nodoc:
def assign_attributes
@queued_for_write[:original] = @file
assign_file_information
assign_fingerprint(@file.fingerprint)
assign_fingerprint { @file.fingerprint }
assign_timestamps
end

Expand All @@ -437,9 +437,9 @@ def assign_file_information
instance_write(:file_size, @file.size)
end

def assign_fingerprint(fingerprint)
def assign_fingerprint
if instance_respond_to?(:fingerprint)
instance_write(:fingerprint, fingerprint)
instance_write(:fingerprint, yield)
end
end

Expand All @@ -465,7 +465,7 @@ def dirty!

def reset_file_if_original_reprocessed
instance_write(:file_size, @queued_for_write[:original].size)
assign_fingerprint(@queued_for_write[:original].fingerprint)
assign_fingerprint { @queued_for_write[:original].fingerprint }
reset_updater
end

Expand Down Expand Up @@ -523,6 +523,10 @@ def post_process_style(name, style) #:nodoc:
@queued_for_write[name] = style.processors.inject(@queued_for_write[:original]) do |file, processor|
file = Paperclip.processor(processor).make(file, style.processor_options, self)
intermediate_files << file unless file == @queued_for_write[:original]
# if we're processing the original, close + unlink the source tempfile
if name == :original
@queued_for_write[:original].close(true)
end
file
end

Expand Down
13 changes: 9 additions & 4 deletions lib/paperclip/content_type_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,22 @@ def empty_file?
alias :empty? :empty_file?

def calculated_type_matches
possible_types.select do |content_type|
content_type == type_from_file_contents
end
possible_types & types_from_file_contents
end

def possible_types
MIME::Types.type_for(@filepath).collect(&:content_type)
end

def types_from_file_contents
[type_from_file_command, type_from_mime_magic].compact
rescue Errno::ENOENT => e
Paperclip.log("Error while determining content type: #{e}")
SENSIBLE_DEFAULT
end

def type_from_file_contents
type_from_mime_magic || type_from_file_command
type_from_file_command || type_from_mime_magic
rescue Errno::ENOENT => e
Paperclip.log("Error while determining content type: #{e}")
SENSIBLE_DEFAULT
Expand Down
2 changes: 1 addition & 1 deletion lib/paperclip/glue.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.included(base)
base.extend ClassMethods
base.send :include, Callbacks
base.send :include, Validators
base.send :include, Schema if defined? ActiveRecord
base.send :include, Schema if defined? ActiveRecord::Base

locale_path = Dir.glob(File.dirname(__FILE__) + "/locales/*.{rb,yml}")
I18n.load_path += locale_path unless I18n.load_path.include?(locale_path)
Expand Down
Loading