magnet links get interpreted as relative links

Open
#3,840 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
php
Domain
backend

Research direction

Start at the feed parsing and link-resolution entry point, using the supplied RSS example with its magnet link to reproduce the malformed URL. Trace how item links are resolved against the feed URL; done means magnet links remain intact and are handed to the magnet: link handler without affecting ordinary relative links.

Written by the indexing model from the issue text.

Description

bug help wanted upstream

IMPORTANT

Read and tick the following checkbox after you have created the issue or place an x inside the brackets ;)

  • I have read the CONTRIBUTING.md and followed the provided tips
  • I accept that the issue will be closed without comment if I do not check here
  • I accept that the issue will be closed without comment if I do not fill out all items in the issue template.

Explain the Problem

What problem did you encounter?
Feeds that contain magnet links (as the example feed below) get parsed as relative links of the form https://www.website.commagnet/?xt=urn:btih:343434343434343434&dn=Example.File.Name%5D&tr=udp://tracker.opentrackr.org/announce and are therefore not valid links.

Steps to Reproduce

Explain what you did to encounter the issue

  1. Add any feed with magnet links
  2. Links of title are malformed.
  3. Clicking on them causes browser to load new tab which fails to reach anything instead of handing over to the designated magnet: link handler

System Information

  • News app version: 28.6.0 (bug present going a long time back, so it's not a recent regression)
  • Nextcloud version: 34.0.1
  • Cron type: (system cron/python updater/...) system
  • PHP version: 8.3.6
  • Database and version: mysql 10.11.14
  • Browser and version: Firefox 152.0
  • OS and version: Fedora Linux 44

Example feed (which would produce the above link):

<rss version="2.0">
           <channel>
              <title>Example feed</title>
              <link>https://www.website.com</link>
              <ttl>300</ttl>
              <description>An example of a feed that breaks News parsing</description>
		<item>
                        <title>Example File name</title>
                        <link>magnet:?xt=urn:btih:343434343434343434&amp;dn=Example.File.Name&amp;tr=udp%3A%2F%2F47tracker.opentrackr.org%3A6969%2Fannounce</link>
                        <guid isPermaLink="false">3d6e18b985be345454545454545454545</guid>
                        <pubDate>Mon, 25 May 2026 06:53:52 +0000</pubDate>
                        <description>New File: Example File</description>
                        <enclosure url="magnet:?xt=urn:btih:343434343434343434&amp;dn=Example.File.Name&amp;tr==udp%3A%2F%2Ftracker.opentracker.org%3A6969%2Fannounce" length="0" type="application/x-bittorrent"/>
                     </item>
...
Contents of nextcloud/data/nextcloud.log The only thing in the log is a header error caused by update process (though update completed without errors), so not related. In old log, no logged issues.
{"reqId":"xeiECrRrFMbwIM70i4iP","level":2,"time":"2026-07-15T13:23:59+00:00","remoteAddr":"XX.XX.XX.XX","user":"--","app":"PHP","method":"GET","url":"/ocs/v2.php/core/update?requesttoken=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","scriptName":"/ocs/v2.php","message":"Cannot modify header information - headers already sent by (output started at /var/www/nextcloud/lib/private/EventSource.php:60) at /var/www/nextcloud/lib/private/AppFramework/Http/Output.php#49","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:152.0) Gecko/20100101 Firefox/152.0","version":"34.0.1.2","data":{"app":"PHP"}}
Contents of Browser Error Console Read http://ggnome.com/wiki/Using_The_Browser_Error_Console if you are unsure what to put here No errors in console, only warnings for formatting, unknown pseudo-selectors (-ms-clear), etc. ``` (nothing relevant)
Dominant language
PHP
Stars
1k
Forks
200
Avg merge
20h 28m
Merged PRs (30d)
32

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nextcloud/news

All issues in nextcloud/news

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.