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

Files are auto deleted if neither Paperless nor Nextcloud are configured #1078

Closed
MatthiasMose opened this issue Jan 18, 2025 · 2 comments
Closed
Labels

Comments

@MatthiasMose
Copy link

My setup: The paperless consume directory is mounted into the node-hp-scan-to container. No API configured.

Since my last docker compose pull the scans don't show up in paperless anymore so I started debugging.

Device: HP Office Jet Pro 6970
Command line or Docker : manuc66/node-hp-scan-to:latest@sha256:1bf1004113bc1e6df197320a5bee50133e26d70d8d0cbc79cb9eeec9242b2905

Scans are auto-deleted before they can be processed by paperless. The KEEP_FILES option has no effect.

I think here is the problematic code:

async function cleanUpFilesIfNeeded(
  filePaths: (string | null)[],
  paperlessConfig: PaperlessConfig | undefined,
  nextcloudConfig: NextcloudConfig | undefined,
) {
  if (!paperlessConfig?.keepFiles && !nextcloudConfig?.keepFiles) {
    await Promise.all(
      filePaths.map(async (filePath) => {
        if (filePath) {
          await fs.unlink(filePath);
          console.log(`File ${filePath} has been removed from the filesystem`);
        }
      }),
    );
  }
}

I'm new to js/ts but I think the if is true if both configs are undefined.

Logs

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/10-adduser
usermod: no changes
User uid:    1000
User gid:    1000
-------------------------------------
s6-rc: fatal: timed out
s6-sudoc: fatal: unable to get exit status from server: Operation timed out
Starting
WARNING: NODE_ENV value of 'production' did not match any deployment config file names.
WARNING: See https://github.com/node-config/node-config/wiki/Strict-Mode
WARNING: No configurations found in configuration directory:/app/config
WARNING: To disable this warning set SUPPRESS_NO_CONFIG_WARNING in the environment.
Current commit ID: a2d016ce0a28553fbdccba2c869b35ac641dc52b
Using device ip: 192.168.178.21
Health endpoint exposed on port 3000 on path: /health
Target folder: /scan
Temp folder: /tmp/scan-to-pcphGkfk
Running iteration: 1 - errorCount: 0
Host destinations fetched: Paperless-ngx
Re-using existing destination: Paperless-ngx - /WalkupScanToComp/WalkupScanToCompDestinations/1c853157-b81e-1f08-b391-b00cd1b454e4
Using: Paperless-ngx
Waiting scan event for: /WalkupScanToComp/WalkupScanToCompDestinations/1c853157-b81e-1f08-b391-b00cd1b454e4
Start listening for new ScanEvent
Scan event captured, saving scan #0
Waiting user input: 1/50
Selected shortcut: SavePDF
Scan will be converted to pdf, using /tmp/scan-to-pcphGkfk as temp scan output directory for individual pages
ScanPlexMode is : Simplex
Afd is : Empty
New job created: http://192.168.178.21:8080/Jobs/JobList/9
Ready to download page job page 1 at: /Scan/Jobs/9/Pages/1
Page downloaded to: /tmp/scan-to-pcphGkfk/scan_18.01.2025_19:41:48.jpg
Job state: Completed, totalPages: 1:
Start listening for new ScanEvent
Scan of page(s) completed totalPages: 1:
The following page(s) have been rendered inside '/scan/scan_18.01.2025_19:41:45.pdf': 
	- page   1 - 2550x3550
File /scan/scan_18.01.2025_19:41:45.pdf has been removed from the filesystem

@manuc66
Copy link
Owner

manuc66 commented Jan 18, 2025

Fix released in v1.6.1

@MatthiasMose
Copy link
Author

Thank you. It's working again!

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

No branches or pull requests

2 participants