From b0443d0a4f53ac8ee787ae1f42db5ef353acef23 Mon Sep 17 00:00:00 2001 From: Martin Czygan Date: Wed, 14 Jun 2023 13:47:16 +0200 Subject: [PATCH] issn: handle file:// entries --- filter/issn.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/filter/issn.go b/filter/issn.go index cc4d1b32..adca4158 100644 --- a/filter/issn.go +++ b/filter/issn.go @@ -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() @@ -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 {