fix uninitialized imageapi pattern string
This commit is contained in:
@@ -238,6 +238,7 @@ func (s *ServerCommand) newServerApp() (*serverApp, error) {
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to make pictures store")
|
||||
}
|
||||
log.Printf("[DEBUG] image service for url=%s, ttl=%v", imageService.ImageAPI, imageService.TTL)
|
||||
|
||||
dataService := &service.DataStore{
|
||||
Interface: storeEngine,
|
||||
@@ -453,7 +454,8 @@ func (s *ServerCommand) makePicturesStore() (*image.Service, error) {
|
||||
MaxHeight: s.Image.ResizeHeight,
|
||||
MaxWidth: s.Image.ResizeWidth,
|
||||
},
|
||||
TTL: s.EditDuration + time.Second, // add extra second to image TTL for staging
|
||||
ImageAPI: s.RemarkURL + "/api/v1/picture/",
|
||||
TTL: s.EditDuration + time.Second, // add extra second to image TTL for staging
|
||||
}, nil
|
||||
}
|
||||
return nil, errors.Errorf("unsupported pictures store type %s", s.Image.Type)
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
func TestService_ExtractPictures(t *testing.T) {
|
||||
svc := Service{ImageAPI: "/blah/"}
|
||||
html := `blah <img src="/blah/user1/pic1.png"/> foo
|
||||
<img src="/blah/user2/pic3.png"/> xyz <p>123</p> <img src="/pic3.png"/>`
|
||||
<img src="/blah/user2/pic3.png"/> xyz <p>123</p> <img src="/pic3.png"/> <img src="https://i.ibb.co/0cqqqnD/ezgif-5-3b07b6b97610.png" alt="">`
|
||||
ids, err := svc.ExtractPictures(html)
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 2, len(ids), "two images")
|
||||
|
||||
Reference in New Issue
Block a user