Cap icon indicating copy to clipboard operation
Cap copied to clipboard

Importing a video whose file name is very long fails with "File name too long"

Open patrickballard opened this issue 3 weeks ago • 1 comments

Description

A video import puts the project in a folder named after the source file plus the import time, for example My Clip 2026-11-07 at 14.23.14.cap. That name is never shortened, so a source file name longer than about 228 characters (before the extension) gives a folder name longer than the 255 a file system allows. The import then fails after analysing the video with "Failed to create project directory: File name too long (os error 63)".

Image imports, recordings and screenshots aren't affected. They name their folders through cap_utils::ensure_unique_filename, which shortens the name to fit.

On macOS the limit counts characters, so it takes a long name such as a video saved under a long page title. On Linux file systems such as ext4 the limit is 255 bytes, so about 77 Chinese or Japanese characters would reach it. I've only reproduced it on macOS.

Reproduction

  1. Save a short MP4 under a 236-character name, for example 236 a characters followed by .mp4.
  2. In Cap, choose Import Media… and pick that file.
  3. The import fails with "Failed to create project directory: File name too long (os error 63)".

Reproduced on macOS by running the video import on such a file with a debug build of main (ebb2db165).

Expected

The video imports, with the folder name shortened to fit, as image imports already do.

patrickballard avatar Nov 07 '26 14:11 patrickballard

CAP-1003

linear[bot] avatar Nov 07 '26 14:11 linear[bot]