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) {
|
func ConvertToMarkdown(c *Config, filename string) ([]byte, error) {
|
||||||
var stderr bytes.Buffer
|
var stderr bytes.Buffer
|
||||||
|
|
||||||
articleID := uuid.New()
|
tmpDir, err := os.MkdirTemp(os.TempDir(), "cpolis_images")
|
||||||
articleFileName := fmt.Sprint("/tmp/", articleID, ".md")
|
|
||||||
|
|
||||||
tmpDir, err := os.MkdirTemp("/tmp", "cpolis_images")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("error creating temporary directory: %v", err)
|
return nil, fmt.Errorf("error creating temporary directory: %v", err)
|
||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
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 := 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
|
cmd.Stderr = &stderr
|
||||||
if err = cmd.Run(); err != nil {
|
if err = cmd.Run(); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user