Sanitize relative inputs to absolute

pull/3/head v0.2.0
Toni Melisma 4 years ago
parent 323b90c1a5
commit d2d78bced9
No known key found for this signature in database
GPG Key ID: FFF9A7EDDEA34756

@ -3,7 +3,7 @@
## Fast static photo and video gallery generator
- Super fast (written in Go and C, concurrent, uses fastest image/video libraries, 4-8 times faster than others)
- Both photo and video support
- Deals with any file formats (ncluding HEIC, HEVC)
- Deals with any file formats (including HEIC and HEVC)
- Only updates changed files, runs incrementally
- Uses relative paths (safe for using in subdirectory or S3)
- Minimal bloat (no third party frontend libraries, minimal CSS)
@ -28,7 +28,7 @@ For Ubuntu 18.04 bionic or 20.04 focal, first add my PPA for latest libvips with
`sudo add-apt-repository ppa:tonimelisma/ppa`
For dependencies, install libvips42 for images and optionally ffmpeg (if you need video support):
Then install libvips42 for images and optionally ffmpeg (if you need video support):
`apt-get install libvips42 ffmpeg`

@ -114,7 +114,18 @@ func parseArgs() (inputDirectory string, outputDirectory string) {
}
}
return *outputDirectoryPtr, flag.Args()[0]
inputDirectory, err := filepath.Abs(flag.Args()[0])
checkError(err)
if err != nil {
os.Exit(1)
}
outputDirectory, err = filepath.Abs(*outputDirectoryPtr)
checkError(err)
if err != nil {
os.Exit(1)
}
return
}
// each file has a corresponding struct with relative and absolute paths
@ -829,7 +840,7 @@ func main() {
var source directory
// parse command-line args and set HTML template ready
outputDirectory, inputDirectory = parseArgs()
inputDirectory, outputDirectory = parseArgs()
fmt.Println(os.Args[0], ": Creating photo gallery")
fmt.Println("")

Loading…
Cancel
Save