Compare commits

..

3 Commits

Author SHA1 Message Date
github-actions[bot]
104513f72b Update version to v1.4.125 and commit 2024-12-22 14:53:17 +00:00
Eugen Eisler
e434999802 Merge pull request #1222 from wmahfoudh/fix-cross-filesystem-move
Fix cross-filesystem file move in to_pdf plugin (issue 1221)
2024-12-22 15:52:13 +01:00
Walid
fce06b5294 Fix cross-filesystem file move in to_pdf plugin (issue 1221) 2024-12-22 13:58:45 +04:00
3 changed files with 32 additions and 3 deletions

View File

@@ -1 +1 @@
"1.4.124"
"1.4.125"

View File

@@ -76,12 +76,19 @@ func main() {
}
// Move the output PDF to the current directory
err = os.Rename(pdfPath, outputFile)
err = copyFile(pdfPath, outputFile)
if err != nil {
fmt.Fprintf(os.Stderr, "Error moving output file: %v\n", err)
os.Exit(1)
}
// Remove the original file after copying
err = os.Remove(pdfPath)
if err != nil {
fmt.Fprintf(os.Stderr, "Error cleaning up temporary file: %v\n", err)
os.Exit(1)
}
// Clean up temporary files
cleanupTempFiles(tmpDir)
@@ -103,3 +110,25 @@ func cleanupTempFiles(dir string) {
}
}
}
// Copy a file from source src to destination dst
func copyFile(src, dst string) error {
sourceFile, err := os.Open(src)
if err != nil {
return err
}
defer sourceFile.Close()
destFile, err := os.Create(dst)
if err != nil {
return err
}
defer destFile.Close()
_, err = io.Copy(destFile, sourceFile)
if err != nil {
return err
}
return destFile.Sync()
}

View File

@@ -1,3 +1,3 @@
package main
var version = "v1.4.124"
var version = "v1.4.125"