MCPcopy Index your code
hub / github.com/deepnote/deepnote / sanitizeTimestampComponent

Function sanitizeTimestampComponent

packages/convert/src/snapshot/split.ts:42–47  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

40 * so the value parses correctly and the greedy notebook-id segment cannot absorb part of the timestamp.
41 */
42function 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. */
50const FILENAME_SAFE_NOTEBOOK_ID_CHAR = /[A-Za-z0-9_-]/

Callers 1

generateSnapshotFilenameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected