aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components
diff options
context:
space:
mode:
authorStas Vilchik <stas.vilchik@sonarsource.com>2017-10-16 10:33:00 +0200
committerStas Vilchik <stas.vilchik@sonarsource.com>2017-10-17 11:32:58 +0200
commit87f55940473777bd4080595a8369a7cf958745c4 (patch)
tree934fb6688a0f0f09d882af1720a2e6fed7b0de76 /server/sonar-web/src/main/js/components
parent96830cb72d30d8f22be83b85ff86b6bc3e3e4ec0 (diff)
downloadsonarqube-87f55940473777bd4080595a8369a7cf958745c4.tar.gz
sonarqube-87f55940473777bd4080595a8369a7cf958745c4.zip
SONAR-9782 Permissions are not correctly checked for a file permalink
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r--server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
index 76facdb4073..508878f6d89 100644
--- a/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
+++ b/server/sonar-web/src/main/js/components/SourceViewer/SourceViewerBase.js
@@ -252,6 +252,7 @@ export default class SourceViewerBase extends React.PureComponent {
issuesByLine: issuesByLine(issues),
issueLocationsByLine: locationsByLine(issues),
loading: false,
+ notAccessible: false,
notExist: false,
hasSourcesAfter: sources.length > LINES,
sources: this.computeCoverageStatus(finalSources),
@@ -270,8 +271,12 @@ export default class SourceViewerBase extends React.PureComponent {
const onFailLoadComponent = ({ response }) => {
// TODO handle other statuses
- if (this.mounted && response.status === 404) {
- this.setState({ loading: false, notExist: true });
+ if (this.mounted) {
+ if (response.status === 403) {
+ this.setState({ loading: false, notAccessible: true });
+ } else if (response.status === 404) {
+ this.setState({ loading: false, notExist: true });
+ }
}
};
@@ -662,6 +667,14 @@ export default class SourceViewerBase extends React.PureComponent {
);
}
+ if (notAccessible) {
+ return (
+ <div className="alert alert-warning spacer-top">
+ {translate('code_viewer.no_source_code_displayed_due_to_security')}
+ </div>
+ );
+ }
+
if (component == null) {
return null;
}
@@ -679,11 +692,6 @@ export default class SourceViewerBase extends React.PureComponent {
component={this.state.component}
showMeasures={this.showMeasures}
/>
- {notAccessible && (
- <div className="alert alert-warning spacer-top">
- {translate('code_viewer.no_source_code_displayed_due_to_security')}
- </div>
- )}
{sourceRemoved && (
<div className="alert alert-warning spacer-top">
{translate('code_viewer.no_source_code_displayed_due_to_source_removed')}