1
0
mirror of https://github.com/imgproxy/imgproxy.git synced 2024-11-24 08:12:38 +02:00

Remove invalid URL specs

This commit is contained in:
DarthSim 2019-09-20 16:34:21 +06:00
parent de804a9245
commit 26bd9e4ac3

View File

@ -52,15 +52,6 @@ func (s *ProcessingOptionsTestSuite) TestParseBase64URLWithBase() {
assert.Equal(s.T(), imageTypePNG, getProcessingOptions(ctx).Format)
}
func (s *ProcessingOptionsTestSuite) TestParseBase64URLInvalid() {
imageURL := "lorem/ipsum.jpg?param=value"
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/%s.png", base64.RawURLEncoding.EncodeToString([]byte(imageURL))))
_, err := parsePath(context.Background(), req)
require.Error(s.T(), err)
assert.Contains(s.T(), err.Error(), "Invalid image url")
}
func (s *ProcessingOptionsTestSuite) TestParsePlainURL() {
imageURL := "http://images.dev/lorem/ipsum.jpg"
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/plain/%s@png", imageURL))
@ -115,24 +106,6 @@ func (s *ProcessingOptionsTestSuite) TestParsePlainURLEscapedWithBase() {
assert.Equal(s.T(), imageTypePNG, getProcessingOptions(ctx).Format)
}
func (s *ProcessingOptionsTestSuite) TestParsePlainURLInvalid() {
imageURL := "lorem/ipsum.jpg?param=value"
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/plain/%s@png", imageURL))
_, err := parsePath(context.Background(), req)
require.Error(s.T(), err)
assert.Contains(s.T(), err.Error(), "Invalid image url")
}
func (s *ProcessingOptionsTestSuite) TestParsePlainURLEscapedInvalid() {
imageURL := "lorem/ipsum.jpg?param=value"
req := s.getRequest(fmt.Sprintf("http://example.com/unsafe/size:100:100/plain/%s@png", url.PathEscape(imageURL)))
_, err := parsePath(context.Background(), req)
require.Error(s.T(), err)
assert.Contains(s.T(), err.Error(), "Invalid image url")
}
func (s *ProcessingOptionsTestSuite) TestParsePathBasic() {
req := s.getRequest("http://example.com/unsafe/fill/100/200/noea/1/plain/http://images.dev/lorem/ipsum.jpg@png")
ctx, err := parsePath(context.Background(), req)