mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-10 01:22:14 +01:00
feat(libreoffice): preserve filenames for zipped files instead of using randomly generated UUID filenames (#793)
* feat(libreoffice): preserve filenames for zipped files instead of using generated UUID filenames * chore: move github.com/google/uuid back to its original line * fix: add libreoffice/routes.go to PR
This commit is contained in:
committed by
Julien Neuhart
parent
e6d7131701
commit
089f161d1e
@@ -191,10 +191,18 @@ func (ctx *Context) FormData() *FormData {
|
||||
}
|
||||
}
|
||||
|
||||
// GeneratePath generates a path within the context's working directory. It
|
||||
// does not create a file.
|
||||
func (ctx *Context) GeneratePath(extension string) string {
|
||||
return fmt.Sprintf("%s/%s%s", ctx.dirPath, uuid.New(), extension)
|
||||
// GeneratePath generates a path within the context's working directory. It does not create a file.
|
||||
// It either generates a new UUID-based filename or uses the provided filename.
|
||||
func (ctx *Context) GeneratePath(extension string, optionalFilename ...string) string {
|
||||
var filename string
|
||||
if len(optionalFilename) > 0 {
|
||||
// Use the provided filename
|
||||
filename = optionalFilename[0]
|
||||
} else {
|
||||
// Generate a new UUID-based filename
|
||||
filename = uuid.New().String()
|
||||
}
|
||||
return fmt.Sprintf("%s/%s%s", ctx.dirPath, filename, extension)
|
||||
}
|
||||
|
||||
// AddOutputPaths adds the given paths. Those paths will be used later to build
|
||||
|
||||
Reference in New Issue
Block a user