Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating video preview fails if generated/tmp path does not exist (post cleanse) #5649

Open
gq1869 opened this issue Feb 5, 2025 · 1 comment

Comments

@gq1869
Copy link

gq1869 commented Feb 5, 2025

When /generated/tmp/ does not exist, Stash fails to generate video previews.

To fix this, we should implement a condition to check if the failing error is os.isnotexist(), then create the directory path and then reattempt the createtemp function.

So, in addition to the standard check on if err != nil, we would write:

	if err != nil && os.IsNotExist(err) {
		if p.Tmp == "" {
			return nil, fmt.Errorf("temporary directory path is empty")
		}
		if mkdirErr := os.MkdirAll(p.Tmp, 0755); mkdirErr != nil {
			return nil, fmt.Errorf("creating temp directory: %w", mkdirErr)
		}
		tmpFile, err = p.TempFile(pattern)
	}

	if err != nil {
		return nil, fmt.Errorf("creating temporary file: %w", err)
	}
@gq1869
Copy link
Author

gq1869 commented Feb 5, 2025

Possible root cause location:

if err != nil {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant