Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
} @else if (previewUrl()) {
<div class="s3-widget__file-icon">
<mat-icon>insert_drive_file</mat-icon>
<span class="s3-widget__filename">{{(internalValue() || value()) | slice:-30}}</span>
<span class="s3-widget__filename">{{displayFilename()}}</span>
</div>
}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export class S3EditComponent implements OnInit {
}
});

readonly displayFilename = computed(() => {
const val = this.internalValue() || this.value();
if (!val) return '';
const name = val.split('/').pop() || val;
return name.length > 40 ? '...' + name.slice(-37) : name;
Comment on lines +75 to +76

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

displayFilename uses magic numbers (40 and 37) to implement truncation. Consider extracting these into named constants (e.g., maxDisplayLength / tailLength) so the intent is clearer and future changes don’t risk off-by-one mistakes.

Copilot uses AI. Check for mistakes.
});
Comment on lines +72 to +77

Copilot AI Feb 10, 2026

Copy link

Choose a reason for hiding this comment

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

Add/adjust unit tests for the new displayFilename computed behavior. There are existing component/spec tests, but they currently only assert that the filename element exists; they should now assert that a path-like key (e.g., uploads/document.pdf) renders just document.pdf, and that long filenames are truncated according to the new 40-char/ellipsis logic.

Copilot uses AI. Check for mistakes.

readonly isImage = computed(() => {
const p = this.params();
const val = this.internalValue() || this.value();
Expand Down
Loading