mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
add: using replaceToInnerDocumentServerUrl()
This commit is contained in:
@ -446,6 +446,8 @@ public class FileController {
|
||||
|
||||
String url = body.getUrl();
|
||||
|
||||
url = urlManager.replaceToInnerDocumentServerUrl(url);
|
||||
|
||||
return requestManager.executeGetRequest(url, new RequestManager.Callback<String>() {
|
||||
@Override
|
||||
public String doWork(final Object response) throws Exception {
|
||||
|
||||
@ -23,6 +23,7 @@ import com.onlyoffice.integration.documentserver.managers.history.HistoryManager
|
||||
import com.onlyoffice.integration.documentserver.storage.FileStorageMutator;
|
||||
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
|
||||
import com.onlyoffice.integration.sdk.manager.DocumentManager;
|
||||
import com.onlyoffice.integration.sdk.manager.UrlManager;
|
||||
import com.onlyoffice.manager.request.RequestManager;
|
||||
import com.onlyoffice.model.commandservice.CommandRequest;
|
||||
import com.onlyoffice.model.commandservice.commandrequest.Command;
|
||||
@ -70,6 +71,9 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
@Autowired
|
||||
private HistoryManager historyManager;
|
||||
|
||||
@Autowired
|
||||
private UrlManager urlManager;
|
||||
|
||||
// download file from url
|
||||
@SneakyThrows
|
||||
private byte[] getDownloadFile(final String url) {
|
||||
@ -132,6 +136,9 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
String curExt = documentManager.getExtension(fileName); // get current file extension
|
||||
String downloadExt = callback.getFiletype(); // get an extension of the downloaded file
|
||||
|
||||
downloadUri = urlManager.replaceToInnerDocumentServerUrl(downloadUri);
|
||||
changesUri = urlManager.replaceToInnerDocumentServerUrl(changesUri);
|
||||
|
||||
// todo: Refactoring
|
||||
// convert downloaded file to the file with the current extension if these extensions aren't equal
|
||||
if (!curExt.equals(downloadExt)) {
|
||||
@ -221,6 +228,8 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
String curExt = documentManager.getExtension(fileName); // get current file extension
|
||||
String downloadExt = callback.getFiletype(); // get an extension of the downloaded file
|
||||
|
||||
downloadUri = urlManager.replaceToInnerDocumentServerUrl(downloadUri);
|
||||
|
||||
Boolean newFileName = false;
|
||||
|
||||
// convert downloaded file to the file with the current extension if these extensions aren't equal
|
||||
@ -277,6 +286,8 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
try {
|
||||
String formsDataUrl = callback.getFormsdataurl();
|
||||
|
||||
formsDataUrl = urlManager.replaceToInnerDocumentServerUrl(formsDataUrl);
|
||||
|
||||
if (formsDataUrl != null && !formsDataUrl.isEmpty()) {
|
||||
String formsName = documentManager.getCorrectName(documentManager
|
||||
.getBaseName(fileName) + ".txt");
|
||||
|
||||
Reference in New Issue
Block a user