Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo sourcce_url => source_url #230

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions lib/imgproxy/url_builders/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,11 @@ def option_strings
end
end

def sourcce_url(image, ext: nil)
def source_url(image, ext: nil)
url = config.url_adapters.url_of(image)

return encrypted_sourcce_url_for(url, ext: ext) if @encrypt_source_url
return base64_sourcce_url_for(url, ext: ext) if @base64_encode_url
return encrypted_source_url_for(url, ext: ext) if @encrypt_source_url
return base64_source_url_for(url, ext: ext) if @base64_encode_url
plain_url_for(url, ext: ext)
end

Expand All @@ -90,19 +90,19 @@ def plain_url_for(url, ext: nil)
ext ? "plain/#{escaped_url}@#{ext}" : "plain/#{escaped_url}"
end

def base64_sourcce_url_for(url, ext: nil)
def base64_source_url_for(url, ext: nil)
encoded_url = Base64.urlsafe_encode64(url).tr("=", "").scan(/.{1,16}/).join("/")

ext ? "#{encoded_url}.#{ext}" : encoded_url
end

def encrypted_sourcce_url_for(url, ext: nil)
def encrypted_source_url_for(url, ext: nil)
cipher = build_cipher

iv = @source_url_encryption_iv || cipher.random_iv
cipher.iv = iv

"enc/#{base64_sourcce_url_for(iv + cipher.update(url) + cipher.final, ext: ext)}"
"enc/#{base64_source_url_for(iv + cipher.update(url) + cipher.final, ext: ext)}"
end

def need_escape_url?(url)
Expand Down
2 changes: 1 addition & 1 deletion lib/imgproxy/url_builders/info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def initialize(options = {})
# the configured URL adapters
# @see Imgproxy.info_url_for
def url_for(image)
path = [*option_strings, sourcce_url(image)].join("/")
path = [*option_strings, source_url(image)].join("/")
signature = sign_path(path)

File.join(endpoint.to_s, "info", signature, path)
Expand Down
2 changes: 1 addition & 1 deletion lib/imgproxy/url_builders/processing.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def initialize(options = {})
# the configured URL adapters
# @see Imgproxy.url_for
def url_for(image)
path = [*option_strings, sourcce_url(image, ext: @format)].join("/")
path = [*option_strings, source_url(image, ext: @format)].join("/")
signature = sign_path(path)

File.join(endpoint.to_s, signature, path)
Expand Down