Skip to content

Commit 2a67010

Browse files
committed
Drop trailing slash of prefix in #get_local_files
The bucket setup in `AssetSync::Storage#bucket` uses fuzzy matching when `config.prefix` is present. This can present a problem in some cases, as it doesn't allow for distinguishing between (e.g.) a bucket folder called `assets/` and another folder called `assets-temp/`. A situation could arise where the latter folder has thousands/millions of files and everything slows to a crawl while we wait for the bucket object to initialize. This change allows developers to be more specific in their `config.prefix` by using a trailing slash for their folder name.
1 parent e729879 commit 2a67010

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/asset_sync/storage.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def get_local_files
140140

141141
log "Using: Directory Search of #{path}/#{self.config.assets_prefix}"
142142
Dir.chdir(path) do
143-
to_load = self.config.assets_prefix.present? ? "#{self.config.assets_prefix}/**/**" : '**/**'
143+
to_load = self.config.assets_prefix.present? ? File.join(self.config.assets_prefix, '/**/**') : '**/**'
144144
Dir[to_load]
145145
end
146146
end

0 commit comments

Comments
 (0)