Page MenuHomePhabricator

API query prop=extlinks adds a trailing forward slash to returned results
Closed, ResolvedPublicBUG REPORT

Description

Observing this behavior on testwiki when using the API to query prop=extlinks on this page in my sandbox. To be clear, haven't seen this on other wikis (e.g. still works correctly on enwp)

Steps to replicate the issue (include links if applicable):

  • Visit this APISandbox link
  • Click Make Request button
  • See extlinks results which have an additional trailing forward slash

What should have happened instead?:
extlinks results should not include a trailing forward slash

Event Timeline

Probably due to T312666: Remove duplication in externallinks table (which according to T335343 is live on testwiki already).

Worth mentioning that all three links on the given page are bare domains, i.e. the issue is that https://github.com is being turned into https://github.com/, not (I assume – haven’t tested it) that e.g. https://github.com/foo is turned into https://github.com/foo/ (which would be more worrying IMHO).

Yeah. It's due to read new. I don't know if there is a way around this TBH. We are storing the "indexed" version of extlinks which loses the signal whether the path is fully empty or '/'. How big of a problem is this?

Did some more testing, and I'm only seeing this occurring with URLs consisting of a bare domain (e.g. https://www.apple.com -> https://www.apple.com/); according to this superuser post, these are equivalent. As @LucasWerkmeister correctly points out above, this is a serious problem only if https://github.com/foo becomes https://github.com/foo/ because depending on the website, these could be routed differently.

How big of a problem is this?

Minor. Although I do think the communication on this (assuming this is how things will be moving forward) needs to be clear (e.g. should be documented on the MediaWiki wiki). I maintain two client libraries (jwiki, pwiki) that rely on the testwiki API for unit testing and was surprised to see them suddenly start failing.

Sure. Tech news would be good enough?

Sure, and would probably also be good to mention this on the mediawiki-api-announce mailing list

Re: Tech News - What wording would you suggest as the content, and when should it be included, and which section? My best-guess (which might be completely inaccurate!) is something like:

Recent Changes

  • The Action API will now add a trailing / to all prop=extlinks queries for bare domains. This is part of the work to remove duplication in the externallinks database table. (1)

It looks good but we probably need to add API and Special:LinkSearch.

  • The Action API modules and Special:LinkSearch will now add a trailing / to all prop=extlinks responses for bare domains. This is part of the work to remove duplication in the externallinks database table. (1)
Ladsgroup claimed this task.
Ladsgroup added a project: DBA.
Ladsgroup moved this task from Triage to Done on the DBA board.