mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Add link(handler) to onRequestHistoryData jwt Java
This commit is contained in:
@ -180,7 +180,7 @@ public class FileModel
|
||||
|
||||
dataObj.put("fileType", FileUtility.GetFileExtension(document.title).substring(1));
|
||||
dataObj.put("key", key);
|
||||
dataObj.put("url", i == curVer ? document.url : DocumentManager.GetPathUri(verDir + File.separator + "prev" + FileUtility.GetFileExtension(document.title)));
|
||||
dataObj.put("url", i == curVer ? document.url : DocumentManager.GetDownloadHistoryUrl(document.title, i.toString(), "prev" + FileUtility.GetFileExtension(document.title)));
|
||||
dataObj.put("version", i);
|
||||
|
||||
if (i > 1) { //check if the version number is greater than 1
|
||||
|
||||
@ -446,6 +446,23 @@ public class DocumentManager
|
||||
}
|
||||
}
|
||||
|
||||
// get url to download a file to History prev.*
|
||||
public static String GetDownloadHistoryUrl(String fileName, String version, String file) {
|
||||
String serverPath = GetServerUrl(true);
|
||||
String hostAddress = CurUserHostAddress(null);
|
||||
try
|
||||
{
|
||||
String query = "?type=download&fileName=" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&userAddress=" + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString());
|
||||
query = query + "&ver=" + URLEncoder.encode(version, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&file=" + URLEncoder.encode(file, java.nio.charset.StandardCharsets.UTF_8.toString());
|
||||
|
||||
return serverPath + "/IndexServlet" + query;
|
||||
}
|
||||
catch (UnsupportedEncodingException e)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
// get an editor internal extension
|
||||
public static String GetInternalExtension(FileType fileType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user