Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix appwebpath detection when OC installed into the subdir and approot is a sibling of oc root dir #31175

Merged
merged 1 commit into from
Apr 18, 2018

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented Apr 17, 2018

Description

Fixes css/js resolution for a case when owncloud installed into the first descendant of the server root directory and app-theme is located outside owncloud root directory.

Related Issue

Fixes #31170

Motivation and Context

rewritten code produced double slash in the case described above and this broke proper URL generation for themes

How Has This Been Tested?

Steps are listed in the issue #31170 (comment)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@VicDeo VicDeo added this to the QA milestone Apr 17, 2018
@VicDeo VicDeo self-assigned this Apr 17, 2018
@@ -531,7 +531,11 @@ public function getAppWebPath($appId) {
$appRoot['url'] = substr($appRoot['url'], 3);
$ocWebRoot = dirname($ocWebRoot);
}
return $ocWebRoot . '/' . ltrim($appRoot['url'], '/');
return sprintf(
Copy link
Contributor

Choose a reason for hiding this comment

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

so no way to just use trim() instead of this exotic approach ?

Copy link
Member Author

@VicDeo VicDeo Apr 17, 2018

Choose a reason for hiding this comment

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

@PVince81 we need to concatenate to two parts with slash and both of them potentially could already have trailing and leading slash respectively.
this is not exotic as we officially prefer interpolation ;)
indeed it can be rewritten like this

$trimmedOcWebRoot = rtrim($ocWebRoot, '/');
$trimmedAppRoot = ltrim($appRoot['url'], '/');
return "$trimmedOcWebRoot/$trimmedAppRoot";

@codecov
Copy link

codecov bot commented Apr 17, 2018

Codecov Report

Merging #31175 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31175      +/-   ##
============================================
+ Coverage     62.55%   62.55%   +<.01%     
  Complexity    18279    18279              
============================================
  Files          1147     1147              
  Lines         68472    68474       +2     
  Branches       1234     1234              
============================================
+ Hits          42831    42833       +2     
  Misses        25280    25280              
  Partials        361      361
Flag Coverage Δ Complexity Δ
#javascript 52.05% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 63.74% <100%> (ø) 18279 <0> (ø) ⬇️
Impacted Files Coverage Δ Complexity Δ
lib/private/App/AppManager.php 85.91% <100%> (+0.13%) 83 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d2cdd2...753eaf6. Read the comment docs.

@VicDeo
Copy link
Member Author

VicDeo commented Apr 17, 2018

@PVince81 ready for review.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍 code looks good, please backport for RC3

@VicDeo
Copy link
Member Author

VicDeo commented Apr 17, 2018

Stable10: #31178

@phil-davis phil-davis merged commit 8e8f38c into master Apr 18, 2018
@phil-davis phil-davis deleted the fix-31170 branch April 18, 2018 02:06
@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enabled theme app outside of OC folder doesn't work
3 participants