(uri)
| 67 | * @param {string} uri |
| 68 | */ |
| 69 | export function decode_uri(uri) { |
| 70 | try { |
| 71 | return decodeURI(uri); |
| 72 | } catch (e) { |
| 73 | if (e instanceof Error) { |
| 74 | e.message = `Failed to decode URI: ${uri}\n` + e.message; |
| 75 | } |
| 76 | throw e; |
| 77 | } |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * Returns everything up to the first `#` in a URL |