@mcp-z/server
    Preparing search index...

    Function parseStoredName

    • Parse a stored filename back into ID and original filename

      Strategy: Find FIRST occurrence of delimiter to split. Everything before = ID, everything after = original filename.

      This means the original filename CAN contain the delimiter without breaking parsing.

      Parameters

      • storedName: string

        Stored filename to parse

      • delimiter: string

        Delimiter used between ID and filename

      Returns { filename: string; id: string }

      Object with id and filename properties

      parseStoredName('abc123-report.pdf', '-')
      // => { id: 'abc123', filename: 'report.pdf' }
      // Handles delimiter in filename correctly
      parseStoredName('abc123-report-2024-final.pdf', '-')
      // => { id: 'abc123', filename: 'report-2024-final.pdf' }
      // Fallback if no delimiter found
      parseStoredName('report.pdf', '-')
      // => { id: 'report.pdf', filename: 'report.pdf' }