Skip to content

Mimetype detection for hidden files#3212

Merged
icewind1991 merged 2 commits intonextcloud:masterfrom
mwalbeck:mimetype-hidden-files
Jan 23, 2017
Merged

Mimetype detection for hidden files#3212
icewind1991 merged 2 commits intonextcloud:masterfrom
mwalbeck:mimetype-hidden-files

Conversation

@mwalbeck
Copy link
Copy Markdown
Contributor

For #3183

Would this work?

Signed-off-by: Magnus Walbeck <mw@mwalbeck.org>
@mention-bot
Copy link
Copy Markdown

@mwalbeck, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rullzer, @LukasReschke and @icewind1991 to be potential reviewers.

Copy link
Copy Markdown
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

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

Otherwise I'm ok with this change

Comment thread lib/private/Files/Type/Detection.php Outdated
$fileName = basename($path);

// remove leading dot on hidden files with a file extension
if (strpos($fileName, '.') === 0 && strpos($fileName, '.', 1)) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

$fileName = ltrim($fileName, '.');

should do the trick 😄

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks

@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 23, 2017

Current coverage is 53.97% (diff: 100%)

Merging #3212 into master will decrease coverage by <.01%

@@             master      #3212   diff @@
==========================================
  Files          1298       1298          
  Lines         80110      80111     +1   
  Methods        7910       7910          
  Messages          0          0          
  Branches       1248       1248          
==========================================
- Hits          43239      43238     -1   
- Misses        36871      36873     +2   
  Partials          0          0          
Diff Coverage File Path
•••••••••• 100% lib/private/Files/Type/Detection.php

Powered by Codecov. Last update 5d48647...3d99ec6

Signed-off-by: Magnus Walbeck <mw@mwalbeck.org>
Copy link
Copy Markdown
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Nice, but this only works for new files right? Old files still have the wrong entry in the database?

@nickvergessen nickvergessen added this to the Nextcloud 12.0 milestone Jan 23, 2017
@nickvergessen nickvergessen added the 3. to review Waiting for reviews label Jan 23, 2017
@mwalbeck
Copy link
Copy Markdown
Contributor Author

Correct, old files will still have the wrong mimetype in the filecache.

@icewind1991
Copy link
Copy Markdown
Member

icewind1991 commented Jan 23, 2017

iirc there is a repair command to fix mimetypes, not sure if it's applicable here

@icewind1991 icewind1991 merged commit d4d1165 into nextcloud:master Jan 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants