Skip to content

Commit

Permalink
Truncate filenames too long
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinB committed Mar 20, 2024
1 parent 7949abf commit 0139d35
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ func writeFile(vmd *cobra.Command, resp *http.Response, record *warc.Record) err
filename = params["filename"]
}

// Truncate the filename if it's too long (keep the extension)
if len(filename) > 255 {
extension := path.Ext(filename)

filename = filename[:255-len(extension)] + extension
}

// Check if the file already exists
outputDir := vmd.Flags().Lookup("output").Value.String()

Expand Down

0 comments on commit 0139d35

Please sign in to comment.