Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sophron
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
sophron
Commits
6e87cd88
Commit
6e87cd88
authored
3 months ago
by
Chandansha Fakir
Committed by
mondrake
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3487753
by chandansha, lavanyatalwar: Support file names with "0" (zero) like foo.0.zip
parent
19f55381
No related branches found
No related tags found
1 merge request
!27
Added foo.0.zip
Pipeline
#370993
passed
2 months ago
Stage: build
Stage: validate
Stage: test
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
sophron_guesser/src/SophronMimeTypeGuesser.php
+3
-1
3 additions, 1 deletion
sophron_guesser/src/SophronMimeTypeGuesser.php
tests/src/Kernel/SophronGuesserTest.php
+2
-0
2 additions, 0 deletions
tests/src/Kernel/SophronGuesserTest.php
with
5 additions
and
1 deletion
sophron_guesser/src/SophronMimeTypeGuesser.php
+
3
−
1
View file @
6e87cd88
...
...
@@ -39,7 +39,9 @@ class SophronMimeTypeGuesser implements MimeTypeGuesserInterface {
// then iterate over the file parts, trying to find a match.
// For 'my.awesome.image.jpeg', we try: 'awesome.image.jpeg', then
// 'image.jpeg', then 'jpeg'.
while
(
array_shift
(
$file_parts
))
{
// We explicitly check for NULL because that indicates that the array is
// empty.
while
(
array_shift
(
$file_parts
)
!==
NULL
)
{
$extension
=
strtolower
(
implode
(
'.'
,
$file_parts
));
$mime_map_extension
=
$this
->
mimeMapManager
->
getExtension
(
$extension
);
try
{
...
...
This diff is collapsed.
Click to expand it.
tests/src/Kernel/SophronGuesserTest.php
+
2
−
0
View file @
6e87cd88
...
...
@@ -96,6 +96,8 @@ class SophronGuesserTest extends KernelTestBase {
'foo.file_test_2'
=>
'application/octet-stream'
,
'foo.doc'
=>
'application/msword'
,
'test.ogg'
=>
'audio/ogg'
,
'foobar.0.zip'
=>
'application/zip'
,
'foobar..zip'
=>
'application/zip'
,
];
$guesser
=
$this
->
container
->
get
(
'file.mime_type.guesser'
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment