Skip to content

Commit

Permalink
issn: handle file:// entries
Browse files Browse the repository at this point in the history
  • Loading branch information
miku committed Jun 14, 2023
1 parent 5bc4df2 commit b0443d0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions filter/issn.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ func (f *ISSNFilter) UnmarshalJSON(p []byte) error {
return err
}
f.Values = container.NewStringSet()

// workaround as span-freeze replacing urls with "file://" protocol and
// http.Get does not recognize that protocol
if strings.HasPrefix(s.ISSN.Link, "file://") {
s.ISSN.File = s.ISSN.Link[7:]
s.ISSN.Link = ""
}
if s.ISSN.Link != "" {
slink := xio.SavedLink{Link: s.ISSN.Link}
filename, err := slink.Save()
Expand All @@ -52,7 +57,6 @@ func (f *ISSNFilter) UnmarshalJSON(p []byte) error {
defer slink.Remove()
s.ISSN.File = filename
}

if s.ISSN.File != "" {
lines, err := xio.ReadLines(s.ISSN.File)
if err != nil {
Expand Down

0 comments on commit b0443d0

Please sign in to comment.