diff options
author | Michael Kaiser <patheticpat@googlemail.com> | 2013-04-09 11:26:58 +0200 |
---|---|---|
committer | Michael Kaiser <patheticpat@googlemail.com> | 2013-04-09 11:26:58 +0200 |
commit | c4ef276467ef0331e905c1aa70f9833a24d85d9c (patch) | |
tree | e98620d421fa66ad91dee8e553432f650c0e1fa6 /src/de/danoeh/antennapod | |
parent | 5da3b934ab148bddd25c67a922a46d73f949dd9c (diff) | |
download | AntennaPod-c4ef276467ef0331e905c1aa70f9833a24d85d9c.zip |
Check MIME-Type when parsing alternate links
Some feeds offer alternate links to feeds representing the content in different
formats, like MP3, AAC or Opus. AntennaPod must not falsely interpret them as
the feed's website link.
Diffstat (limited to 'src/de/danoeh/antennapod')
-rw-r--r-- | src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java index 522b16efe..25d0b7c35 100644 --- a/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java +++ b/src/de/danoeh/antennapod/syndication/namespace/atom/NSAtom.java @@ -42,6 +42,10 @@ public class NSAtom extends Namespace { private static final String LINK_REL_PAYMENT = "payment"; private static final String LINK_REL_RELATED = "related"; private static final String LINK_REL_SELF = "self"; + // type-values + private static final String LINK_TYPE_ATOM = "application/atom+xml"; + private static final String LINK_TYPE_HTML = "text/html"; + private static final String LINK_TYPE_RSS = "application/rss+xml"; /** Regexp to test whether an Element is a Text Element. */ private static final String isText = TITLE + "|" + CONTENT + "|" + "|" @@ -85,7 +89,10 @@ public class NSAtom extends Namespace { } } else if (parent.getName().matches(isFeed)) { if (rel == null || rel.equals(LINK_REL_ALTERNATE)) { - state.getFeed().setLink(href); + String type = attributes.getValue(LINK_TYPE); + if (type != null && type.equals(LINK_TYPE_HTML)) { + state.getFeed().setLink(href); + } } else if (rel.equals(LINK_REL_PAYMENT)) { state.getFeed().setPaymentLink(href); } |