mirror of
https://github.com/miniflux/v2.git
synced 2025-07-02 16:38:37 +00:00
Improve OPML import/export
This commit is contained in:
parent
ace7524905
commit
a76c2a8c22
15 changed files with 51 additions and 31 deletions
|
@ -6,12 +6,13 @@ package opml
|
|||
|
||||
import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/miniflux/miniflux2/errors"
|
||||
"golang.org/x/net/html/charset"
|
||||
)
|
||||
|
||||
// Parse reads an OPML file and returns a SubcriptionList.
|
||||
func Parse(data io.Reader) (SubcriptionList, error) {
|
||||
opml := new(Opml)
|
||||
decoder := xml.NewDecoder(data)
|
||||
|
@ -19,7 +20,7 @@ func Parse(data io.Reader) (SubcriptionList, error) {
|
|||
|
||||
err := decoder.Decode(opml)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Unable to parse OPML file: %v\n", err)
|
||||
return nil, errors.NewLocalizedError("Unable to parse OPML file: %v", err)
|
||||
}
|
||||
|
||||
return opml.Transform(), nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue