@@ -31,18 +31,24 @@ Portions Copyright (c) 2018-2019, Chris Fraire <
[email protected] >.
31
31
java.text.Format,
32
32
java.text.SimpleDateFormat,
33
33
java.util.Date,
34
+ java.util.logging.Level,
35
+ java.util.logging.Logger,
34
36
java.util.Objects,
35
37
java.util.Set,
36
38
java.util.regex.Pattern,
37
39
40
+ org.opengrok.indexer.configuration.RuntimeEnvironment,
38
41
org.opengrok.indexer.history.History,
39
42
org.opengrok.indexer.history.HistoryEntry,
40
- org.opengrok.indexer.configuration.RuntimeEnvironment"
43
+ org.opengrok.indexer.logger.LoggerFactory,
44
+ org.opengrok.indexer.util.ForbiddenSymlinkException,
45
+ org.opengrok.indexer.web.SearchHelper"
41
46
%>
42
47
<% /* ---------------------- history.jsp start --------------------- */
43
48
{
44
- PageConfig cfg = PageConfig . get(request );
49
+ final Logger LOGGER = LoggerFactory . getLogger(getClass() );
45
50
51
+ PageConfig cfg = PageConfig . get(request);
46
52
cfg. checkSourceRootExistence();
47
53
48
54
// Need to set the title before including httpheader.jspf
@@ -51,10 +57,30 @@ org.opengrok.indexer.configuration.RuntimeEnvironment"
51
57
String path = cfg. getPath();
52
58
53
59
if (path. length() > 0 ) {
54
- File f = cfg. getResourceFile();
55
- History hist = null ;
60
+ String primePath = path;
61
+ Project project = cfg. getProject();
62
+ if (project != null ) {
63
+ SearchHelper searchHelper = cfg. prepareInternalSearch();
64
+ /*
65
+ * N.b. searchHelper.destroy() is called via
66
+ * WebappListener.requestDestroyed() on presence of the following
67
+ * REQUEST_ATTR.
68
+ */
69
+ request. setAttribute(SearchHelper . REQUEST_ATTR , searchHelper);
70
+ searchHelper. prepareExec(project);
71
+
72
+ try {
73
+ primePath = searchHelper. getPrimeRelativePath(project. getName(), path);
74
+ } catch (IOException | ForbiddenSymlinkException ex) {
75
+ LOGGER . log(Level . WARNING , String . format(
76
+ " Error getting prime relative for %s" , path), ex);
77
+ }
78
+ }
79
+
80
+ File file = cfg. getResourceFile(primePath);
81
+ History hist;
56
82
try {
57
- hist = HistoryGuru . getInstance(). getHistoryUI(f );
83
+ hist = HistoryGuru . getInstance(). getHistoryUI(file );
58
84
} catch (Exception e) {
59
85
// should not happen
60
86
response. sendError(HttpServletResponse . SC_NOT_FOUND , e. getMessage());
0 commit comments