Skip to content

handle exceptions in SMB::stat - #7556

Merged
MorrisJobke merged 1 commit into
masterfrom
smb-stat-exception
Dec 18, 2017
Merged

handle exceptions in SMB::stat#7556
MorrisJobke merged 1 commit into
masterfrom
smb-stat-exception

Conversation

@icewind1991

Copy link
Copy Markdown
Member

Properly handle non existing/non readable files

Signed-off-by: Robin Appelman <robin@icewind.nl>
@codecov

codecovBot commented Dec 18, 2017

Copy link
Copy Markdown

Codecov Report

Merging #7556 into master will decrease coverage by <.01%.
The diff coverage is 0%.

@@ Coverage Diff @@## master #7556 +/- ##
============================================
- Coverage 51.18% 51.18% -0.01% - Complexity 24874 24876 +2 
============================================
Files 1601 1601 Lines 94707 94712 +5 Branches 1368 1368 ============================================
Hits 48475 48475 - Misses 46232 46237 +5
Impacted FilesCoverage ΔComplexity Δ
apps/files_external/lib/Lib/Storage/SMB.php5.53% <0%> (-0.11%)118 <5> (+2)

@rullzerrullzer left a comment

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.

Sounds sane

@MorrisJobke
MorrisJobke merged commit b01d20c into masterDec 18, 2017
@MorrisJobke
MorrisJobke deleted the smb-stat-exception branch December 18, 2017 21:31
@MorrisJobkeMorrisJobke mentioned this pull request Jan 2, 2018
30 tasks
@rik26

rik26 commented Jun 5, 2019

Copy link
Copy Markdown

With Nextcloud 16, the problem still appears with symlink on share, i tested the following code, and it works :
I put a comment here too :
#7332

/**
* get the best guess for the modification time of the share
*
* @return int
*/
private function shareMTime() {
$highestMTime = 0;
$files = $this->share->dir($this->root);
foreach ($files as $fileInfo) {
try {
if ($fileInfo->getMTime() > $highestMTime) {
$highestMTime = $fileInfo->getMTime();
}
} catch (NotFoundException $e) {
// Ignore this, can happen on unavailable DFS shares
- }
+ } catch (ForbiddenException $e) {
+ // Ignore this too : symlink
+ }
}
return $highestMTime;
}

@icewind1991

Copy link
Copy Markdown
MemberAuthor

@rik26 can you submit a PR with your change

@rik26

rik26 commented Jun 5, 2019

Copy link
Copy Markdown

@icewind1991 It's not i'm not willing to help, but i don't understand how to make a PR... And sorry for the duplicate but as the issue was closed i created a new one ...

#15876

Sorry for being useless..

@MorrisJobke

Copy link
Copy Markdown
Member

Sorry for being useless..

You are not useless. Thanks for the hint already.

I opened a PR at #16195

rullzer pushed a commit that referenced this pull request Jul 8, 2019
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to reviewWaiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@icewind1991@rik26@MorrisJobke@rullzer