Page MenuHomePhabricator

Error msg shown when trying to open a link
Closed, ResolvedPublic

Description

When trying to open the link to Who’s the Man from this article, I get the error messages shown below.
https://en.wikipedia.org/wiki/Party_and_Bullshit?wprov=sfti1

Version: WikipediaApp/6.9.3.1980 (iOS 16.1; Phone)

unnamed.jpg (2×1 px, 64 KB)

unnamed (1).jpg (2×1 px, 69 KB)

Event Timeline

LGoto triaged this task as Medium priority.Oct 24 2022, 6:51 PM
LGoto moved this task from Needs Triage to Bug Backlog on the Wikipedia-iOS-App-Backlog board.
LGoto added a project: ios-app-v7.1.
LGoto subscribed.

New PR: https://github.com/wikimedia/wikipedia-ios/pull/4444

The old PR was failing CircleCI tests, and the problem was that in iOS 15.5, URLComponents cannot be initialized with a string containing international (non-ASCII) characters. The tests still passed on my local computer because I was running them in iOS 16.2.

Note:

This PR fixes the existing code for encoding relative hrefs, and it does not hurt to do so, but I am not aware of any Wikipedia article links where we must percent-encode more than what is already encoded (except international characters). As mentioned above, encoding international characters in href before using it to initialize URLComponents is necessary, but after that, no further encoding is necessary to pass the URLParsingAndRoutingTests unit tests.

The code for encoding relative hrefs seems to have been originally added in this commit by @JoeWalsh in method ArticleViewController.handleLink (later moved to file URL+LinkParsing.swift, URL.resolvingRelativeWikiHref), but the reason for doing so isn't in the PR or commit messages.

Even if it isn't strictly necessary I think it's good practice to encode relative URLs just in case, but if there are cases where the further encoding is necessary, it would be helpful to add unit test cases for them.

Tsevener moved this task from Needs Code Review to Waiting for Build on the ios-app-v7.1 board.
Tsevener added a subscriber: junholee6a.
ABorbaWMF subscribed.

Looks fixed to me on 7.2.0 (2028)

JTannerWMF claimed this task.