Skip file upload when input only accepts images, not PDF/DOC

Some LinkedIn listings have image-only upload fields (JPG/PNG).
Don't attempt to upload a PDF resume to these inputs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 17:41:34 -08:00
parent 6a1423eab6
commit 814492d9b6

View File

@@ -573,7 +573,12 @@ Answer:`;
if (radios[0]) await radios[0].click().catch(() => {});
} else if (snap.resumeRadios.length === 0 && snap.hasFileInput && resumePath) {
const fileInput = await container.$('input[type="file"]');
if (fileInput) await fileInput.setInputFiles(resumePath).catch(() => {});
if (fileInput) {
// Skip if the file input doesn't accept our resume format (e.g. image-only uploads)
const accept = await fileInput.getAttribute('accept').catch(() => '') || '';
const acceptsResume = !accept || /pdf|doc|docx/i.test(accept);
if (acceptsResume) await fileInput.setInputFiles(resumePath).catch(() => {});
}
}
// --- Inputs (text/number/url/email/tel) ---