Skip to content

Commit 159caeb

Browse files
authored
Improve: Make regex more stable (#383)
* Improve: Make regex more stable * Fix: Tests
1 parent 095e349 commit 159caeb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/SearchIndexAdapter/DefaultSearch/DataObject/FieldDefinitionAdapter/TextKeywordAdapter.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public function getIndexMapping(): array
4040
);
4141
}
4242

43-
public function normalize(mixed $value): ?string
43+
public function normalize(mixed $value): mixed
4444
{
45-
if ($value) {
46-
return preg_replace("/src=['\"]data:[^;]+;base64,.+?['\"]/", '', $value);
45+
if (is_string($value) && $value !== '') {
46+
return preg_replace("/src=(['\"])data:[^;]+;base64,.+?\\1/", '', $value);
4747
}
4848

49-
return null;
49+
return parent::normalize($value);
5050
}
5151
}

0 commit comments

Comments
 (0)