Compare commits

...

51 Commits

Author SHA1 Message Date
fcb807471f Merge pull request #406 from ONLYOFFICE/release/1.6.0
Release/1.6.0
2023-06-29 11:07:55 +05:00
50a4ddbd11 1.6.0 2023-06-29 11:00:42 +05:00
01d1dc4274 Merge pull request #405 from ONLYOFFICE/hotfix/csharp-reload-filelist-upload
Hotfix/csharp reload filelist upload
2023-06-28 11:20:58 +05:00
1447b304eb Merge pull request #404 from ONLYOFFICE/hotfix/delete-old-file-after-convert
Hotfix/delete old file after convert
2023-06-28 11:20:24 +05:00
8e79c6448f csharp: reload after click on edit or view in upload window 2023-06-27 12:08:59 +03:00
badf3c7d49 csharp-mvc: reload after click on edit or view in upload window 2023-06-27 12:08:35 +03:00
342b31f7d7 java-spring: delete original file after convert 2023-06-27 11:32:28 +03:00
0ae8f5d396 java: delete original file after convert 2023-06-27 11:09:43 +03:00
7a238c2b73 Merge branch 'release/v7.4.0' into hotfix/delete-old-file-after-convert 2023-06-27 10:55:39 +03:00
0b4c67e552 Merge branch 'hotfix/headers-charset-on-upload-convert' into release/v7.4.0 2023-06-27 12:10:42 +05:00
f5391051b1 ruby: delete original file after convert 2023-06-27 09:59:00 +03:00
01c8a940d4 csharp: fix error with convert response (6aa80c4a8c) 2023-06-26 17:33:42 +05:00
579992e40b Merge pull request #402 from ONLYOFFICE/hotfix/csharp
fixed: generating key
2023-06-26 15:42:14 +05:00
3a2218a466 Merge pull request #401 from ONLYOFFICE/hotfix/ruby-filelist-reload-fix
ruby: reload after click on edit or view in upload window
2023-06-26 15:40:55 +05:00
0ea28f525f Merge pull request #400 from ONLYOFFICE/hotfix/disable-cors-on-download
php: disable CORS on download
2023-06-26 15:40:27 +05:00
33363f6144 fixed: generating key 2023-06-26 13:01:03 +03:00
da8bdca022 ruby: reload after click on edit or view in upload window 2023-06-26 12:52:17 +03:00
c4eccc5ee8 Merge pull request #398 from ONLYOFFICE/hotfix/php-sample-key-fix
php: undefined "sample" key fix
2023-06-26 14:24:02 +05:00
ab13745cf6 Merge pull request #399 from ONLYOFFICE/hotfix/referenceData
Hotfix/reference data
2023-06-26 14:23:09 +05:00
97f07e4275 ruby: fixed directUrl property 2023-06-26 12:20:07 +03:00
7c3e250797 php: undefined "sample" key fix 2023-06-26 11:40:57 +03:00
32ab794f11 python: fixed directUrl property 2023-06-26 11:23:03 +03:00
800ef84f84 csharp: fixed directUrl property 2023-06-26 11:18:52 +03:00
a7e4036667 php: fixed directUrl property 2023-06-26 11:11:52 +03:00
4f589a7394 java: fixed directUrl property 2023-06-26 11:05:01 +03:00
a3abb58d72 java-spring: fixed directUrl property 2023-06-26 10:21:21 +03:00
17536df8e5 csharp-mvc: fixed directUrl property 2023-06-26 10:08:44 +03:00
2e8a483a0c csharp-mvc: fix error with convert response (d9a79e20d7) 2023-06-26 11:47:38 +05:00
a0aa7b4fd0 php: disable CORS on download 2023-06-23 13:38:06 +03:00
8b720beffa Merge pull request #397 from ONLYOFFICE/hotfix/java-spring
java-spring: fixed bug with update external links reference data
2023-06-23 11:36:50 +05:00
a1c286cbaa java-spring: fixed bug with update external links reference data 2023-06-23 09:05:26 +03:00
fc377b967d Merge pull request #395 from ONLYOFFICE/hotfix/disable-cors-for-download
python: disable CORS in download
2023-06-22 17:43:07 +05:00
b2de5eff4c Merge pull request #394 from ONLYOFFICE/hotfix/python-reload-file-list
python: reload file list after start of editing
2023-06-22 17:42:31 +05:00
02439f3699 Merge pull request #393 from ONLYOFFICE/hotfix/php-fixes-release-740
Hotfix/php fixes for release 7.4.0
2023-06-22 17:41:28 +05:00
2429f21a84 python: disable CORS in download 2023-06-22 12:13:36 +03:00
aa0a4b5400 php: encoded space used 2023-06-22 11:48:51 +03:00
a28300848b python: reload file list after start of editing 2023-06-22 11:22:56 +03:00
fec0e87218 php: fix warnings in editor 2023-06-22 10:46:36 +03:00
efbace1e8b php: correct name of file when downloading 2023-06-22 10:30:37 +03:00
35e479355a php: convert warning fix 2023-06-22 10:22:17 +03:00
32c91b9016 Merge pull request #392 from ONLYOFFICE/hotfix/users-permissions-fix
java: null instead of empty lists
2023-06-21 16:01:01 +05:00
183d165c00 java: null instead of empty lists 2023-06-21 12:40:35 +03:00
a996f2c3c3 Merge pull request #390 from ONLYOFFICE/hotfix/content-disposition-for-download-encode
python: filename encoding for content-disposition header
2023-06-21 13:19:06 +05:00
782243eb86 Merge pull request #391 from ONLYOFFICE/hotfix/java-spring
Hotfix/java spring
2023-06-21 13:18:15 +05:00
f058d68126 fix bug with switching from view to edit 2023-06-21 11:11:33 +03:00
a8f07fce4d fix bug with upload file size more 1MB 2023-06-21 11:11:28 +03:00
025bd1068d fix bug with file conversion 2023-06-21 11:11:17 +03:00
1da93ce071 python: filename encoding for content-disposition header 2023-06-21 09:37:26 +03:00
837e34de37 Merge pull request #389 from ONLYOFFICE/hotfix/convert-status-code-type
ruby: fix conversion service status type
2023-06-20 13:52:27 +05:00
20c4ec1b78 ruby: fix conversion service status type 2023-06-20 11:30:40 +03:00
5865fedbe7 java: upload and convert fix 2023-06-05 10:19:58 +03:00
31 changed files with 96 additions and 55 deletions

View File

@ -1,5 +1,6 @@
# Change Log
## 1.6.0
- nodejs: setUsers for region protection
- si skin languages
- fix "no" skin languages

View File

@ -220,6 +220,7 @@ namespace OnlineEditorsExampleMVC.Helpers
var fileName = GetCorrectName(demoName); // get a file name with an index if the file with such a name already exists
File.Copy(HttpRuntime.AppDomainAppPath + demoPath + demoName, StoragePath(fileName)); // copy file to the storage directory
File.SetLastWriteTime(StoragePath(fileName), DateTime.Now);
return fileName;
}

View File

@ -236,6 +236,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginView:not(.disable)", function () {
@ -244,6 +245,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {

View File

@ -249,14 +249,14 @@ namespace OnlineEditorsExampleMVC
// get the url and file type of the converted file
Dictionary<string, string> newFileData;
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, internalExtension, key, true, out newFileData, filePass, lang);
var newFileUri = newFileData["fileUrl"];
var newFileType = "." + newFileData["fileType"];
if (result != 100)
{
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
return;
}
var newFileUri = newFileData["fileUrl"];
var newFileType = "." + newFileData["fileType"];
// get a file name of an internal file extension with an index if the file with such a name already exists
var correctName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + newFileType);
@ -659,10 +659,12 @@ namespace OnlineEditorsExampleMVC
return;
}
var directUrl = (bool)body["directUrl"];
var data = new Dictionary<string, object>() {
{ "fileType", (Path.GetExtension(fileName) ?? "").ToLower() },
{ "fileType", (Path.GetExtension(fileName) ?? "").ToLower().Trim('.') },
{ "url", DocManagerHelper.GetDownloadUrl(fileName)},
{ "directUrl", DocManagerHelper.GetDownloadUrl(fileName) },
{ "directUrl", directUrl ? DocManagerHelper.GetDownloadUrl(fileName, false) : null },
{ "referenceData", new Dictionary<string, string>()
{
{ "fileKey", jss.Serialize(new Dictionary<string, object>{
@ -670,7 +672,7 @@ namespace OnlineEditorsExampleMVC
{"userAddress", HttpUtility.UrlEncode(DocManagerHelper.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress))}
})
},
{"instanceId", DocManagerHelper.GetServerUrl(false) }
{ "instanceId", DocManagerHelper.GetServerUrl(false) }
}
},
{ "path", fileName }

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<appSettings>
<clear />
<add key="version" value="1.5.1"/>
<add key="version" value="1.6.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>

View File

@ -489,13 +489,13 @@ namespace OnlineEditorsExample
// get the url and file type of the converted file
Dictionary<string, string> newFileData;
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, internalExtension, key, true, out newFileData, filePass, lang);
var newFileUri = newFileData["fileUrl"];
var newFileType = "." + newFileData["fileType"];
if (result != 100)
{
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
}
var newFileUri = newFileData["fileUrl"];
var newFileType = "." + newFileData["fileType"];
// get a file name of an internal file extension with an index if the file with such a name already exists
var fileName = GetCorrectName(Path.GetFileNameWithoutExtension(_fileName) + newFileType);

View File

@ -632,6 +632,7 @@ namespace OnlineEditorsExample
var filePath = _Default.StoragePath(FileName, null);
File.Copy(HttpRuntime.AppDomainAppPath + demoPath + demoName, filePath); // copy this file to the storage directory
File.SetLastWriteTime(filePath, DateTime.Now);
// create a json file with file meta data
var id = request.Cookies.GetOrDefault("uid", null);

View File

@ -477,10 +477,12 @@ namespace OnlineEditorsExample
return;
}
var directUrl = (bool) body["directUrl"];
var data = new Dictionary<string, object>() {
{ "fileType", (Path.GetExtension(fileName) ?? "").ToLower() },
{ "fileType", (Path.GetExtension(fileName) ?? "").ToLower().Trim('.') },
{ "url", DocEditor.getDownloadUrl(fileName)},
{ "directUrl", DocEditor.getDownloadUrl(fileName) },
{ "directUrl", directUrl ? DocEditor.getDownloadUrl(fileName, false) : null},
{ "referenceData", new Dictionary<string, string>()
{
{ "fileKey", jss.Serialize(new Dictionary<string, object>{

View File

@ -236,6 +236,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginView:not(.disable)", function () {
@ -244,6 +245,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<clear />
<add key="version" value="1.5.1"/>
<add key="version" value="1.6.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>

View File

@ -36,6 +36,7 @@ import com.onlyoffice.integration.documentserver.util.service.ServiceConverter;
import com.onlyoffice.integration.documentserver.managers.document.DocumentManager;
import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
@ -64,6 +65,7 @@ import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Optional;
@ -234,6 +236,9 @@ public class FileController {
throw new RuntimeException("Input stream is null");
}
// remove source file
storageMutator.deleteFile(fileName);
// create the converted file with input stream
storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(correctedName)), stream);
fileName = correctedName;
@ -459,18 +464,18 @@ public class FileController {
@ResponseBody
public String reference(@RequestBody final JSONObject body) {
try {
JSONParser parser = new JSONParser();
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
String userAddress = "";
String fileName = "";
if (body.containsKey("referenceData")) {
JSONObject referenceDataObj = (JSONObject) body.get("referenceData");
LinkedHashMap referenceDataObj = (LinkedHashMap) body.get("referenceData");
String instanceId = (String) referenceDataObj.get("instanceId");
if (instanceId.equals(storagePathBuilder.getServerUrl(false))) {
JSONObject fileKey = (JSONObject) referenceDataObj.get("fileKey");
JSONObject fileKey = (JSONObject) parser.parse((String) referenceDataObj.get("fileKey"));
userAddress = (String) fileKey.get("userAddress");
if (userAddress.equals(InetAddress.getLocalHost().getHostAddress())) {
fileName = (String) fileKey.get("fileName");
@ -496,18 +501,20 @@ public class FileController {
return "{ \"error\": \"File not found\"}";
}
boolean directUrl = (boolean) body.get("directUrl");
HashMap<String, Object> fileKey = new HashMap<>();
fileKey.put("fileName", fileName);
fileKey.put("userAddress", InetAddress.getLocalHost().getHostAddress());
HashMap<String, Object> referenceData = new HashMap<>();
referenceData.put("instanceId", storagePathBuilder.getServerUrl(true));
referenceData.put("fileKey", fileKey);
referenceData.put("fileKey", gson.toJson(fileKey));
HashMap<String, Object> data = new HashMap<>();
data.put("fileType", fileUtility.getFileExtension(fileName));
data.put("fileType", fileUtility.getFileExtension(fileName).replace(".", ""));
data.put("url", documentManager.getDownloadUrl(fileName, true));
data.put("directUrl", documentManager.getDownloadUrl(fileName, true));
data.put("directUrl", directUrl ? documentManager.getDownloadUrl(fileName, false) : null);
data.put("referenceData", referenceData);
data.put("path", fileName);

View File

@ -106,17 +106,17 @@ public class DefaultServiceConverter implements ServiceConverter {
connection.connect();
try (OutputStream os = connection.getOutputStream()) {
os.write(bodyByte); // write bytes to the output stream
os.flush(); // force write data to the output stream that can be cached in the current thread
}
int statusCode = connection.getResponseCode();
if (statusCode != HttpStatus.OK.value()) { // checking status code
connection.disconnect();
throw new RuntimeException("Convertation service returned status: " + statusCode);
}
try (OutputStream os = connection.getOutputStream()) {
os.write(bodyByte); // write bytes to the output stream
os.flush(); // force write data to the output stream that can be cached in the current thread
}
response = connection.getInputStream(); // get the input stream
jsonString = convertStreamToString(response); // convert the response stream into a string
} finally {

View File

@ -1,4 +1,4 @@
server.version=1.5.1
server.version=1.6.0
server.address=
server.port=4000
@ -38,6 +38,8 @@ spring.jpa.database-platform=org.hibernate.dialect.H2Dialect
hibernate.ddl-auto
spring.h2.console.enabled=true
spring.h2.console.path=/h2
spring.servlet.multipart.max-file-size=5MB
spring.servlet.multipart.max-request-size=5MB
url.index=/
url.converter=/converter

View File

@ -52,7 +52,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("\&?action=view\&?", "i"), "");
location.href = location.href.replace(RegExp("\&?action=view", "i"), "");
};
// an error or some other specific event occurs

View File

@ -78,6 +78,11 @@ public class IndexServlet extends HttpServlet {
return;
}
// charset for response headers if upload or convert
if (action.matches("upload|convert")) {
response.setCharacterEncoding("UTF-8");
}
DocumentManager.init(request, response);
// create a variable to display information about the application and error messages
@ -310,9 +315,9 @@ public class IndexServlet extends HttpServlet {
connection.disconnect();
// remove source file ?
// File sourceFile = new File(DocumentManager.StoragePath(fileName, null));
// sourceFile.delete();
// remove source file
File sourceFile = new File(DocumentManager.storagePath(fileName, null));
sourceFile.delete();
fileName = correctName;
@ -695,6 +700,8 @@ public class IndexServlet extends HttpServlet {
return;
}
boolean directUrl = (boolean) body.get("directUrl");
HashMap<String, Object> fileKey = new HashMap<>();
fileKey.put("fileName", fileName);
fileKey.put("userAddress", DocumentManager.curUserHostAddress(null));
@ -704,9 +711,9 @@ public class IndexServlet extends HttpServlet {
referenceData.put("fileKey", gson.toJson(fileKey));
HashMap<String, Object> data = new HashMap<>();
data.put("fileType", FileUtility.getFileExtension(fileName));
data.put("fileType", FileUtility.getFileExtension(fileName).replace(".", ""));
data.put("url", DocumentManager.getDownloadUrl(fileName, true));
data.put("directUrl", DocumentManager.getDownloadUrl(fileName, true));
data.put("directUrl", directUrl ? DocumentManager.getDownloadUrl(fileName, false) : null);
data.put("referenceData", referenceData);
data.put("path", fileName);

View File

@ -213,14 +213,15 @@ public final class ServiceConverter {
connection.connect();
try (OutputStream os = connection.getOutputStream()) {
os.write(bodyByte);
}
int statusCode = connection.getResponseCode();
if (statusCode != HttpServletResponse.SC_OK) { // checking status code
connection.disconnect();
throw new Exception("Conversion service returned status: " + statusCode);
}
try (OutputStream os = connection.getOutputStream()) {
os.write(bodyByte);
}
InputStream stream = connection.getInputStream();

View File

@ -86,11 +86,11 @@ public final class Users {
true, new ArrayList<String>(), descriptionUserSecond, false));
add(new User("uid-3", "Hamish Mitchell", "mitchell@example.com",
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
Arrays.asList("group-2"), new ArrayList<String>()), Arrays.asList("group-2"),
Arrays.asList("group-2"), null), Arrays.asList("group-2"),
false, Arrays.asList("copy", "download", "print"),
descriptionUserThird, false));
add(new User("uid-0", null, null,
"", null, new CommentGroups(), new ArrayList<String>(),
"", null, null, null,
null, Arrays.asList("protect"), descriptionUserZero, false));
}};

View File

@ -1,4 +1,4 @@
version=1.5.1
version=1.6.0
filesize-max=5242880
storage-folder=app_data

View File

@ -1,5 +1,5 @@
{
"version": "1.5.1",
"version": "1.6.0",
"log": {
"appenders": [
{

View File

@ -250,7 +250,7 @@ function convert()
$post = json_decode(file_get_contents('php://input'), true);
$fileName = basename($post["filename"]);
$filePass = $post["filePass"];
$lang = $_COOKIE["ulang"];
$lang = $_COOKIE["ulang"] ?? "";
$extension = mb_strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$internalExtension = "ooxml";
$configManager = new ConfigManager();
@ -445,8 +445,8 @@ function download()
$fileName = realpath($configManager->getConfig("storagePath"))
=== $configManager->getConfig("storagePath") ?
$_GET["fileName"] : basename($_GET["fileName"]); // get the file name
$userAddress = $_GET["userAddress"];
$isEmbedded = $_GET["&dmode"];
$userAddress = $_GET["userAddress"] ?? null;
$isEmbedded = $_GET["&dmode"] ?? null;
$jwtManager = new JwtManager();
if ($jwtManager->isJwtEnabled() && $isEmbedded == null && $userAddress) {
@ -491,8 +491,9 @@ function downloadFile($filePath)
// write headers to the response object
@header('Content-Length: ' . filesize($filePath));
@header('Content-Disposition: attachment; filename*=UTF-8\'\'' . urldecode(basename($filePath)));
@header('Content-Disposition: attachment; filename*=UTF-8\'\'' . str_replace("+", "%20", urlencode(basename($filePath))));
@header('Content-Type: ' . mime_content_type($filePath));
@header('Access-Control-Allow-Origin: *');
if ($fd = fopen($filePath, 'rb')) {
while (!feof($fd)) {
@ -588,9 +589,9 @@ function reference()
}
$data = [
"fileType" => getInternalExtension($fileName),
"fileType" => trim(getInternalExtension($fileName), '.'),
"url" => getDownloadUrl($fileName),
"directUrl" => $post["directUrl"] ? getDownloadUrl($fileName) : getDownloadUrl($fileName, false),
"directUrl" => $post["directUrl"] ? getDownloadUrl($fileName, false) : null,
"referenceData" => [
"fileKey" => json_encode([
"fileName" => $fileName,

View File

@ -1,5 +1,5 @@
{
"version": "1.5.1",
"version": "1.6.0",
"fileSizeMax": 5242880,
"storagePath": "",

View File

@ -895,8 +895,9 @@ function getResponseUri($document_response, &$response_uri)
*/
function tryGetDefaultByType($createExt, $user)
{
$demoName = ($_GET["sample"] ? "sample." : "new.") . $createExt;
$demoPath = "assets" . DIRECTORY_SEPARATOR . ($_GET["sample"] ? "sample" : "new") . DIRECTORY_SEPARATOR;
$sample = isset($_GET["sample"]) && $_GET["sample"];
$demoName = ($sample ? "sample." : "new.") . $createExt;
$demoPath = "assets" . DIRECTORY_SEPARATOR . ($sample ? "sample" : "new") . DIRECTORY_SEPARATOR;
$demoFilename = GetCorrectName($demoName);
if (!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . $demoPath . $demoName, getStoragePath($demoFilename))) {

View File

@ -43,13 +43,14 @@ final class DocEditorView extends View
$confgManager = new ConfigManager();
$jwtManager = new JwtManager();
$userList = new ExampleUsers();
$fileId = $request["fileID"] ?? "";
$user = $userList->getUser($request["user"]);
$isEnableDirectUrl = isset($request["directUrl"]) ? filter_var($request["directUrl"], FILTER_VALIDATE_BOOLEAN)
: false;
if (!empty($externalUrl)) {
$filename = doUpload($externalUrl);
} else { // if the file url doesn't exist, get file name and file extension
$filename = basename($request["fileID"]);
$filename = basename($fileId);
}
$createExt = $request["fileExt"] ?? "";

View File

@ -1,6 +1,6 @@
import os
VERSION = '1.5.1'
VERSION = '1.6.0'
FILE_SIZE_MAX = 5242880
STORAGE_PATH = 'app_data'

View File

@ -293,6 +293,7 @@ def getFilesInfo(req):
def download(filePath):
response = FileResponse(open(filePath, 'rb'), True) # write headers to the response object
response['Content-Length'] = os.path.getsize(filePath)
response['Content-Disposition'] = "attachment;filename*=UTF-8\'\'" + urllib.parse.unquote(os.path.basename(filePath))
response['Content-Disposition'] = "attachment;filename*=UTF-8\'\'" + urllib.parse.quote_plus(os.path.basename(filePath))
response['Content-Type'] = magic.from_file(filePath, mime=True)
response['Access-Control-Allow-Origin'] = "*"
return response

View File

@ -492,9 +492,9 @@ def reference(request):
return HttpResponse(json.dumps(response), content_type='application/json', status=404)
data = {
'fileType' : fileUtils.getFileExt(fileName),
'fileType' : fileUtils.getFileExt(fileName).replace('.', ''),
'url' : docManager.getDownloadUrl(fileName, request),
'directUrl' : docManager.getDownloadUrl(fileName, request) if body["directUrl"] else docManager.getDownloadUrl(fileName, request, False),
'directUrl' : docManager.getDownloadUrl(fileName, request, False) if body["directUrl"] else None,
'referenceData' : {
'instanceId' : docManager.getServerUrl(False, request),
'fileKey' : json.dumps({'fileName' : fileName, 'userAddress': request.META['REMOTE_ADDR']})

View File

@ -235,6 +235,7 @@ if (typeof jQuery !== "undefined") {
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginView:not(.disable)", function () {
@ -243,6 +244,7 @@ if (typeof jQuery !== "undefined") {
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {

View File

@ -240,6 +240,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginView:not(.disable)", function () {
@ -248,6 +249,7 @@ if (typeof jQuery != "undefined") {
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {

View File

@ -131,6 +131,11 @@ class HomeController < ApplicationController
file.write(data)
end
old_storage_path = DocumentHelper.storage_path(file_name, nil)
if File.exist?(old_storage_path)
File.delete(old_storage_path)
end
file_name = correct_name
user = Users.get_user(params[:userId])
@ -395,9 +400,9 @@ class HomeController < ApplicationController
end
data = {
:fileType => DocumentHelper.get_internal_extension(fileName),
:fileType => File.extname(fileName).downcase.delete("."),
:url => DocumentHelper.get_download_url(fileName),
:directUrl => body["directUrl"] ? DocumentHelper.get_download_url(fileName) : DocumentHelper.get_download_url(fileName,false),
:directUrl => body["directUrl"] ? DocumentHelper.get_download_url(fileName, false) : nil,
:referenceData => {
:instanceId => DocumentHelper.get_server_url(false),
:fileKey => {:fileName => fileName,:userAddress => DocumentHelper.cur_user_host_address(nil)}.to_json

View File

@ -68,13 +68,13 @@ class ServiceConverter
req.body = payload.to_json
res = http.request(req) # get the response
status_code = res.code
status_code = res.code.to_i
if status_code != 200 # checking status code
raise "Conversion service returned status: #{status_code}"
end
data = res.body # and take its body
rescue TimeoutError
rescue Timeout::Error
# try again
rescue => ex
raise ex.message

View File

@ -26,7 +26,7 @@ module OnlineEditorsExampleRuby
end
end
Rails.configuration.version="1.5.1"
Rails.configuration.version="1.6.0"
Rails.configuration.fileSizeMax=5242880
Rails.configuration.storagePath="app_data"