Skip to content

Commit d97cbcd

Browse files
authored
AOS-294: Forager Bifrost > Document search extraction limit could be worded better (#25)
* AOS-294: Modified the alert message for text extraction of large file sizes * AOS-294: Fixed linting * AOS-294: Fix unit test
1 parent 54e8996 commit d97cbcd

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

lang/en.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
en:
22
SilverStripe\ForagerBifrost\Extensions\FileFormExtension:
33
FILE_LIMIT_MESSAGE: "Document search extraction limit is {limit}"
4-
LARGE_FILE_WARNING: "File size is {size} which exceeds the search extraction limit of {limit}"
4+
LARGE_FILE_WARNING: "Text contained within this {size} file cannot be indexed for search. The file size limit for text extraction is {limit}."

src/Extensions/FileFormExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ private function createLargeFileWarning(File $file): ?LiteralField
7878
['class' => 'alert alert-warning'],
7979
_t(
8080
self::class . '.LARGE_FILE_WARNING',
81-
'File size is {size} which exceeds the search extraction limit of {limit}',
81+
'Text contained within this {size} file cannot be indexed for search. '
82+
. 'The file size limit for text extraction is {limit}.',
8283
[
8384
'size' => $file->getSize(),
8485
'limit' => SearchFile::sizeLimit(),

tests/Extensions/FileFormExtensionTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ public function testCreateLargeFileWarning(): void
139139

140140
$this->assertInstanceOf(LiteralField::class, $field);
141141
$this->assertEquals(
142-
'<p class="alert alert-warning">File size is 16 MB which exceeds the search extraction limit of 15 MB</p>',
142+
'<p class="alert alert-warning">Text contained within this 16 MB file cannot be indexed for search.'
143+
. ' The file size limit for text extraction is 15 MB.</p>',
143144
$field->getContent()
144145
);
145146
}

0 commit comments

Comments
 (0)