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 signed url #7

Merged
merged 4 commits into from
May 21, 2024
Merged

fix signed url #7

merged 4 commits into from
May 21, 2024

Conversation

ankur-dwivedi
Copy link
Collaborator

@ankur-dwivedi ankur-dwivedi commented May 17, 2024

if !cmp.Equal(tr, expectedTr) {
t.Errorf("url: %s, expected tr: %s\ngot tr: %s", tc.url, expectedTr, tr)
}
if !urlsEquals(url, tc.url) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was only an assertion for URLs containing tr: inside the path, so
here added an assertion that will test all the URLs.

url.go Show resolved Hide resolved
}
})
}

}

func extractTransformation(t *testing.T, url string) (urlResult string, trResult []string) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this because it was not needed anymore. This function removes transformations from the path and checks whether they exist in the URL. Now, we are directly matching URLs.
This was needed earlier because the sequence of transformation was not fixed earlier refer here

@imagekitio
Copy link
Contributor

LGTM.

@@ -76,6 +73,43 @@ func TestUrl(t *testing.T) {
},
url: "https://ik.imagekit.io/test/default-image.jpg?ik-t=1653775928&ik-s=48842eca663c6895331331db6c90f262c601f4e8",
}, {
name: "signed-url-with-transformation",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a test case for signed url without expiry

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done added a test case for signed URL without expiry

@ahnv
Copy link
Member

ahnv commented May 21, 2024

LGTM

@imagekitio imagekitio merged commit 1d7e6e6 into master May 21, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants