Avoid risk of crash with URL extension

Part of #283