Use the correct tmpDir
This commit is contained in:
parent
5d251c3659
commit
62e75eaea8
@ -14,15 +14,13 @@ import (
|
||||
func ConvertToMarkdown(c *Config, filename string) ([]byte, error) {
|
||||
var stderr bytes.Buffer
|
||||
|
||||
articleID := uuid.New()
|
||||
articleFileName := fmt.Sprint("/tmp/", articleID, ".md")
|
||||
|
||||
tmpDir, err := os.MkdirTemp("/tmp", "cpolis_images")
|
||||
tmpDir, err := os.MkdirTemp(os.TempDir(), "cpolis_images")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("error creating temporary directory: %v", err)
|
||||
}
|
||||
defer os.RemoveAll(tmpDir)
|
||||
|
||||
articleFileName := filepath.Join(os.TempDir(), fmt.Sprint(uuid.New(), ".md"))
|
||||
cmd := exec.Command("pandoc", "-s", "-f", "docx", "-t", "commonmark_x", "-o", articleFileName, "--extract-media", tmpDir, filename) // TODO: Is writing to a file necessary?
|
||||
cmd.Stderr = &stderr
|
||||
if err = cmd.Run(); err != nil {
|
||||
|
Loading…
x
Reference in New Issue
Block a user