* Normalizes snapshot timestamps for filenames: keeps digits, `T`, and `-`, maps other separators to `-`, * so the value parses correctly and the greedy notebook-id segment cannot absorb part of the timestamp.
(timestamp: string)
| 40 | * so the value parses correctly and the greedy notebook-id segment cannot absorb part of the timestamp. |
| 41 | */ |
| 42 | function sanitizeTimestampComponent(timestamp: string): string { |
| 43 | if (timestamp === 'latest') { |
| 44 | return timestamp |
| 45 | } |
| 46 | return timestamp.replace(/[^0-9T-]+/g, '-').replace(/-+$/g, '') |
| 47 | } |
| 48 | |
| 49 | /** Characters kept verbatim inside an encoded notebook id; every other character is percent-escaped. */ |
| 50 | const FILENAME_SAFE_NOTEBOOK_ID_CHAR = /[A-Za-z0-9_-]/ |
no outgoing calls
no test coverage detected