File tree Expand file tree Collapse file tree 3 files changed +7
-12
lines changed
main/java/org/opengrok/indexer/web
test/java/org/opengrok/indexer/web
opengrok-web/src/main/webapp Expand file tree Collapse file tree 3 files changed +7
-12
lines changed Original file line number Diff line number Diff line change @@ -1334,16 +1334,12 @@ public boolean isLatestRevision(String rev) {
1334
1334
1335
1335
/**
1336
1336
* Get the location of cross reference for given file containing the given revision.
1337
- * @param revStr revision string
1338
- * @return location to redirect to or null if revision string is empty
1337
+ * @param revStr defined revision string
1338
+ * @return location to redirect to
1339
1339
*/
1340
1340
public String getRevisionLocation (String revStr ) {
1341
1341
StringBuilder sb = new StringBuilder ();
1342
1342
1343
- if (revStr == null ) {
1344
- return null ;
1345
- }
1346
-
1347
1343
sb .append (req .getContextPath ());
1348
1344
sb .append (Prefix .XREF_P );
1349
1345
sb .append (Util .URIEncodePath (path ));
Original file line number Diff line number Diff line change 19
19
20
20
/*
21
21
* Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
22
+ * Portions Copyright (c) 2020, Chris Fraire <[email protected] >.
22
23
*/
23
24
package org .opengrok .indexer .web ;
24
25
@@ -332,9 +333,6 @@ public String getPathInfo() {
332
333
PageConfig cfg = PageConfig .get (req2 );
333
334
String rev = cfg .getLatestRevision ();
334
335
assertNull (rev );
335
-
336
- String location = cfg .getRevisionLocation (cfg .getLatestRevision ());
337
- assertNull (location );
338
336
}
339
337
340
338
@ Test
Original file line number Diff line number Diff line change @@ -76,8 +76,9 @@ final String DUMMY_REVISION = "unknown";
76
76
* Get the latest revision and redirect so that the revision number
77
77
* appears in the URL.
78
78
*/
79
- String location = cfg. getRevisionLocation(cfg. getLatestRevision());
80
- if (location != null ) {
79
+ String latestRevision = cfg. getLatestRevision();
80
+ if (latestRevision != null ) {
81
+ String location = cfg. getRevisionLocation(latestRevision);
81
82
response. sendRedirect(location);
82
83
return ;
83
84
}
@@ -88,7 +89,7 @@ final String DUMMY_REVISION = "unknown";
88
89
* revision string so that xref can be generated from the resource
89
90
* file directly.
90
91
*/
91
- location = cfg. getRevisionLocation(DUMMY_REVISION );
92
+ String location = cfg. getRevisionLocation(DUMMY_REVISION );
92
93
response. sendRedirect(location);
93
94
return ;
94
95
}
You can’t perform that action at this time.
0 commit comments