Skip to content

lisa/fix-screenshots-only-as-image-types#233

Closed
gusfcarvalho wants to merge 1 commit into
mainfrom
lisa/fix-screenshots-only-as-image-types
Closed

lisa/fix-screenshots-only-as-image-types#233
gusfcarvalho wants to merge 1 commit into
mainfrom
lisa/fix-screenshots-only-as-image-types

Conversation

@gusfcarvalho
Copy link
Copy Markdown
Contributor

automated implementation by lisa.

Copilot AI review requested due to automatic review settings May 15, 2026 12:32
@gusfcarvalho gusfcarvalho deleted the lisa/fix-screenshots-only-as-image-types branch May 15, 2026 12:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens “screenshot” evidence handling so that screenshot uploads are restricted to image formats (and properly labeled as images), aligning UI validation with downstream rendering expectations (e.g., image-only rendering for base64 resources).

Changes:

  • Make the file input accept list and help text dependent on the selected evidence type (document vs screenshot).
  • Add client-side validation to reject disallowed file types for the chosen evidence type.
  • Improve workflow evidence mediaType inference (including adding WebP support) and add unit tests for the new validation behavior.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/views/workflow-executions/partials/EvidenceSubmissionForm.vue Dynamically sets accepted file types/help text and validates uploaded files by evidence type.
src/views/workflow-executions/partials/tests/EvidenceSubmissionForm.spec.ts Adds tests to confirm screenshot is image-only, document keeps doc+image support, and WebP is accepted.
src/composables/workflows/useStepExecutions.ts Adjusts evidence mediaType inference to prefer the file MIME type and adds WebP mapping.
Comments suppressed due to low confidence (1)

src/views/workflow-executions/partials/EvidenceSubmissionForm.vue:245

  • In the oversized-files branch you clear selectedFiles but you don't clear the underlying <input type="file"> value. That can prevent users from re-selecting the same file (the change event may not fire) and leaves the invalid selection in the control. Consider resetting target.value = '' here as well (similar to the invalid-type branch).
    // Validate each file size (10MB max)
    const oversizedFiles = files.filter((file) => file.size > 10 * 1024 * 1024);
    if (oversizedFiles.length > 0) {
      submitError.value = `The following files exceed 10MB limit: ${oversizedFiles.map((f) => f.name).join(', ')}`;
      selectedFiles.value = [];
      return;
    }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +260 to +265
function isAllowedFileType(file: File): boolean {
const config = fileTypeConfig.value;
if (!config) return false;

const ext = file.name.split('.').pop()?.toLowerCase();
return !!ext && config.extensions.includes(ext);
Comment on lines +224 to +231
watch(
() => evidenceForm.value.type,
() => {
selectedFiles.value = [];
submitError.value = '';
const fileInput = document.getElementById('file') as HTMLInputElement;
if (fileInput) fileInput.value = '';
},
Comment on lines 148 to 156
// Determine media type based on evidence type or file
let mediaType = 'application/octet-stream';
if (ev.evidenceType === 'screenshot') {
mediaType = 'image/png';
} else if (ev.file?.type) {
if (ev.file?.type) {
mediaType = ev.file.type;
} else if (ev.evidenceType === 'screenshot') {
mediaType = 'image/png';
} else if (ev.fileName) {
// Guess from extension
const ext = ev.fileName.split('.').pop()?.toLowerCase();
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

Successfully merging this pull request may close these issues.

2 participants