aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/components
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2016-10-27 13:59:18 +0200
committerStas Vilchik <vilchiks@gmail.com>2016-10-27 13:59:18 +0200
commit059692599345f5a22b5c9b25c34189cf09a99cb8 (patch)
treeb1aefe6f098fc47b1ae0d74fc7844189261ade18 /server/sonar-web/src/main/js/components
parentcae60cc46c6866315699f5106e363410bc0915e6 (diff)
downloadsonarqube-059692599345f5a22b5c9b25c34189cf09a99cb8.tar.gz
sonarqube-059692599345f5a22b5c9b25c34189cf09a99cb8.zip
do not display global error when source viewer can't show code due to security reason
Diffstat (limited to 'server/sonar-web/src/main/js/components')
-rw-r--r--server/sonar-web/src/main/js/components/source-viewer/main.js13
1 files changed, 10 insertions, 3 deletions
diff --git a/server/sonar-web/src/main/js/components/source-viewer/main.js b/server/sonar-web/src/main/js/components/source-viewer/main.js
index 497e3d847c0..ca259f91d35 100644
--- a/server/sonar-web/src/main/js/components/source-viewer/main.js
+++ b/server/sonar-web/src/main/js/components/source-viewer/main.js
@@ -215,8 +215,15 @@ export default Marionette.LayoutView.extend({
requestSource (aroundLine) {
const that = this;
const url = window.baseUrl + '/api/sources/lines';
- const options = _.extend({ uuid: this.model.id }, this.linesLimit(aroundLine));
- return $.get(url, options).done(function (data) {
+ const data = _.extend({ uuid: this.model.id }, this.linesLimit(aroundLine));
+ return $.ajax({
+ url,
+ data,
+ statusCode: {
+ // don't display global error
+ 403: null
+ }
+ }).done(function (data) {
let source = (data.sources || []).slice(0);
if (source.length === 0 || (source.length > 0 && _.first(source).line === 1)) {
source.unshift({ line: 0 });
@@ -228,7 +235,7 @@ export default Marionette.LayoutView.extend({
});
});
const firstLine = _.first(source).line;
- const linesRequested = options.to - options.from + 1;
+ const linesRequested = data.to - data.from + 1;
that.model.set({
source,
hasUTCoverage: that.model.hasUTCoverage(source),