Skip to content

Commit

Permalink
Ensure workspace and template can't be empty strings
Browse files Browse the repository at this point in the history
  • Loading branch information
kvz committed Nov 28, 2024
1 parent 2625559 commit 42f9904
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/transloadit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ def signed_smart_cdn_url(
expire_at_ms: nil,
url_params: {}
)
raise ArgumentError, "workspace is required" if workspace.nil?
raise ArgumentError, "template is required" if template.nil?
raise ArgumentError, "workspace is required" if workspace.nil? || workspace.empty?
raise ArgumentError, "template is required" if template.nil? || template.empty?
raise ArgumentError, "input is required" if input.nil?

workspace_slug = CGI.escape(workspace)
Expand Down
16 changes: 16 additions & 0 deletions test/unit/transloadit/test_smart_cdn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def run_node_script(params)
input: @input
)
end

assert_raises ArgumentError, "workspace is required" do
@transloadit.signed_smart_cdn_url(
workspace: "",
template: @template,
input: @input
)
end
end

it "requires template" do
Expand All @@ -41,6 +49,14 @@ def run_node_script(params)
input: @input
)
end

assert_raises ArgumentError, "template is required" do
@transloadit.signed_smart_cdn_url(
workspace: @workspace,
template: "",
input: @input
)
end
end

it "requires input" do
Expand Down

0 comments on commit 42f9904

Please sign in to comment.