Page MenuHomePhabricator

User/file-names containing _ breaks notebook imports
Closed, ResolvedPublic

Description

Trying to do the import below, it breaks because _ is interpreted as a space and then url encoded into:
https://paws-public.wmflabs.org/paws-public/User:Abbe98%20Bot/geo.ipynb?format=raw

while the expected url is the following:
https://paws-public.wmflabs.org/paws-public/User:Abbe98_Bot/geo.ipynb?format=raw

import paws.Abbe98_Bot.geo

This does also applies to underscores in filenames.

Also some usernames are incompatible with Python, by for example containing parentheses.

Event Timeline

@yuvipanda I tracked this down to the following line in the ipynb-paws repository:

url_segment = '/'.join([s.replace('_', ' ') for s in parts]) + '.ipynb?format=raw'

What's the reason for the replacement of underscores?

Abbe98 renamed this task from Some usernames breaks notebook imports to User/file-names containing _ breaks notebook imports.Feb 6 2017, 10:29 PM
Abbe98 updated the task description. (Show Details)
Chicocvenancio moved this task from Backlog to Easy tasks on the PAWS board.

Including this change in the rebuilt cluster to see how it goes.

Bstorm claimed this task.

This should now be fixed. On the other hand, there are many illegal characters in python imports that are likely to not work still. Something to mess with one day.