diff --git a/.github/workflows/artifact-csharp-mvc.yml b/.github/workflows/artifact-csharp-mvc.yml
index c543d0bc..c333a679 100644
--- a/.github/workflows/artifact-csharp-mvc.yml
+++ b/.github/workflows/artifact-csharp-mvc.yml
@@ -3,10 +3,10 @@ name: Artifact Csharp MVC
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/csharp-mvc/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/csharp-mvc/**']
jobs:
diff --git a/.github/workflows/artifact-csharp.yml b/.github/workflows/artifact-csharp.yml
index 6c9ec93e..04045571 100644
--- a/.github/workflows/artifact-csharp.yml
+++ b/.github/workflows/artifact-csharp.yml
@@ -3,10 +3,10 @@ name: Artifact Csharp
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/csharp/**']
pull_request:
- branches: [master, main, develop]
+ branches: [master]
paths: ['web/documentserver-example/csharp/**']
jobs:
diff --git a/.github/workflows/artifact-java.yml b/.github/workflows/artifact-java.yml
index 1a4ce3ac..cea169f9 100644
--- a/.github/workflows/artifact-java.yml
+++ b/.github/workflows/artifact-java.yml
@@ -3,10 +3,10 @@ name: Artifact Java
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/java/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/java/**']
jobs:
diff --git a/.github/workflows/artifact-node.yml b/.github/workflows/artifact-node.yml
index 46461cbb..a6bf809e 100644
--- a/.github/workflows/artifact-node.yml
+++ b/.github/workflows/artifact-node.yml
@@ -3,10 +3,10 @@ name: Artifact Nodejs
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/nodejs/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/nodejs/**']
jobs:
diff --git a/.github/workflows/artifact-php.yml b/.github/workflows/artifact-php.yml
index 65a07544..4c435db4 100644
--- a/.github/workflows/artifact-php.yml
+++ b/.github/workflows/artifact-php.yml
@@ -3,10 +3,10 @@ name: Artifact PHP
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/php/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/php/**']
jobs:
diff --git a/.github/workflows/artifact-python.yml b/.github/workflows/artifact-python.yml
index afdc28a3..be0b878d 100644
--- a/.github/workflows/artifact-python.yml
+++ b/.github/workflows/artifact-python.yml
@@ -3,10 +3,10 @@ name: Artifact Python
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/python/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/python/**']
jobs:
diff --git a/.github/workflows/artifact-ruby.yml b/.github/workflows/artifact-ruby.yml
index 7aff4de5..2cf3b005 100644
--- a/.github/workflows/artifact-ruby.yml
+++ b/.github/workflows/artifact-ruby.yml
@@ -3,10 +3,10 @@ name: Artifact Ruby
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/ruby/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/ruby/**']
jobs:
diff --git a/.github/workflows/artifact-spring.yml b/.github/workflows/artifact-spring.yml
index e49b336c..0de71f0c 100644
--- a/.github/workflows/artifact-spring.yml
+++ b/.github/workflows/artifact-spring.yml
@@ -3,10 +3,10 @@ name: Artifact Java Spring
on:
workflow_dispatch:
push:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/java-spring/**']
pull_request:
- branches: [master, main]
+ branches: [master]
paths: ['web/documentserver-example/java-spring/**']
jobs:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 05842d70..0728c1e8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
# Change Log
+- trimming long name of uploading file
+- nodejs: link in referenceData
- onRequestSelectDocument method
- onRequestSelectSpreadsheet method
- key in referenceData
diff --git a/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs b/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs
index 7e7f8b21..4de69296 100644
--- a/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs
+++ b/web/documentserver-example/csharp-mvc/Helpers/DocManagerHelper.cs
@@ -177,7 +177,12 @@ namespace OnlineEditorsExampleMVC.Helpers
// get a file name with an index if the file with such a name already exists
public static string GetCorrectName(string fileName, string userAddress = null)
{
+ int maxName;
+ int.TryParse(WebConfigurationManager.AppSettings["filename-max"], out maxName);
var baseName = Path.GetFileNameWithoutExtension(fileName);
+ if (baseName.Length > maxName){
+ baseName = baseName.Substring(0, maxName) + "[...]";
+ }
var ext = Path.GetExtension(fileName).ToLower();
var name = baseName + ext;
diff --git a/web/documentserver-example/csharp-mvc/web.appsettings.config b/web/documentserver-example/csharp-mvc/web.appsettings.config
index 5d7ebdfe..fb6b5f44 100644
--- a/web/documentserver-example/csharp-mvc/web.appsettings.config
+++ b/web/documentserver-example/csharp-mvc/web.appsettings.config
@@ -5,6 +5,7 @@
+
diff --git a/web/documentserver-example/csharp/Default.aspx.cs b/web/documentserver-example/csharp/Default.aspx.cs
index 403afb44..eabac5f8 100644
--- a/web/documentserver-example/csharp/Default.aspx.cs
+++ b/web/documentserver-example/csharp/Default.aspx.cs
@@ -538,7 +538,12 @@ namespace OnlineEditorsExample
// get the correct file name if such a name already exists
public static string GetCorrectName(string fileName, string userAddress = null)
{
+ int maxName;
+ int.TryParse(WebConfigurationManager.AppSettings["filename-max"], out maxName);
var baseName = Path.GetFileNameWithoutExtension(fileName); // get file name without extension
+ if (baseName.Length > maxName){
+ baseName = baseName.Substring(0, maxName) + "[...]";
+ }
var ext = Path.GetExtension(fileName).ToLower(); // get file extension
var name = baseName + ext; // get full file name
diff --git a/web/documentserver-example/csharp/settings.config b/web/documentserver-example/csharp/settings.config
index b9b1b0bc..a827d70f 100644
--- a/web/documentserver-example/csharp/settings.config
+++ b/web/documentserver-example/csharp/settings.config
@@ -5,6 +5,7 @@
+
diff --git a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/documentserver/util/file/DefaultFileUtility.java b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/documentserver/util/file/DefaultFileUtility.java
index 568b260b..d20763f8 100755
--- a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/documentserver/util/file/DefaultFileUtility.java
+++ b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/documentserver/util/file/DefaultFileUtility.java
@@ -38,6 +38,8 @@ import static com.onlyoffice.integration.documentserver.util.Constants.MAX_FILE_
public class DefaultFileUtility implements FileUtility {
@Value("${filesize-max}")
private String filesizeMax;
+ @Value("${filename-max}")
+ private String filenameMax;
@Autowired
private FormatService formatService;
@@ -136,13 +138,18 @@ public class DefaultFileUtility implements FileUtility {
// generate the file path from file directory and name
public Path generateFilepath(final String directory, final String fullFileName) {
- String fileName = getFileNameWithoutExtension(fullFileName); // get file name without extension
+ int maxName = Integer.parseInt(filenameMax);
+ String fileName = getFileNameWithoutExtension(fullFileName);
+ if (fileName.length() > maxName) {
+ fileName = fileName.substring(0, maxName) + "[...]";
+ }
String fileExtension = getFileExtension(fullFileName); // get file extension
- Path path = Paths.get(directory + fullFileName); // get the path to the files with the specified name
+ // get the path to the files with the specified name
+ Path path = Paths.get(directory + fileName + "." + fileExtension);
for (int i = 1; Files.exists(path); i++) { // run through all the files with the specified name
// get a name of each file without extension and add an index to it
- fileName = getFileNameWithoutExtension(fullFileName) + "(" + i + ")";
+ fileName = fileName + "(" + i + ")";
// create a new path for this file with the correct name and extension
path = Paths.get(directory + fileName + "." + fileExtension);
diff --git a/web/documentserver-example/java-spring/src/main/resources/application.properties b/web/documentserver-example/java-spring/src/main/resources/application.properties
index ad0c6762..9c4c3f77 100755
--- a/web/documentserver-example/java-spring/src/main/resources/application.properties
+++ b/web/documentserver-example/java-spring/src/main/resources/application.properties
@@ -4,6 +4,7 @@ server.address=
server.port=4000
filesize-max=5242880
+filename-max=50
files.storage=
files.storage.folder=documents
diff --git a/web/documentserver-example/java/src/main/java/helpers/DocumentManager.java b/web/documentserver-example/java/src/main/java/helpers/DocumentManager.java
index 2e4d5dc1..28d91c8b 100755
--- a/web/documentserver-example/java/src/main/java/helpers/DocumentManager.java
+++ b/web/documentserver-example/java/src/main/java/helpers/DocumentManager.java
@@ -246,7 +246,11 @@ public final class DocumentManager {
// get a file name with an index if the file with such a name already exists
public static String getCorrectName(final String fileName, final String userAddress) {
+ int maxName = Integer.parseInt(ConfigManager.getProperty("filename-max"));
String baseName = FileUtility.getFileNameWithoutExtension(fileName);
+ if (baseName.length() > maxName) {
+ baseName = baseName.substring(0, maxName) + "[...]";
+ }
String ext = FileUtility.getFileExtension(fileName);
String name = baseName + "." + ext;
diff --git a/web/documentserver-example/java/src/main/resources/settings.properties b/web/documentserver-example/java/src/main/resources/settings.properties
index 547e2d39..98a9daab 100644
--- a/web/documentserver-example/java/src/main/resources/settings.properties
+++ b/web/documentserver-example/java/src/main/resources/settings.properties
@@ -2,6 +2,7 @@ version=1.7.0
filesize-max=5242880
storage-folder=app_data
+filename-max=50
files.docservice.timeout=120000
diff --git a/web/documentserver-example/nodejs/config/default.json b/web/documentserver-example/nodejs/config/default.json
index c964090b..2e9fda9e 100644
--- a/web/documentserver-example/nodejs/config/default.json
+++ b/web/documentserver-example/nodejs/config/default.json
@@ -25,6 +25,7 @@
"storageFolder": "./files",
"storagePath": "/files",
"maxFileSize": 1073741824,
+ "maxNameLength": 50,
"mobileRegEx": "android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",
"token": {
"enable": false,
diff --git a/web/documentserver-example/nodejs/helpers/docManager.js b/web/documentserver-example/nodejs/helpers/docManager.js
index e0dafa60..3a67e477 100644
--- a/web/documentserver-example/nodejs/helpers/docManager.js
+++ b/web/documentserver-example/nodejs/helpers/docManager.js
@@ -84,7 +84,10 @@ DocManager.prototype.getCustomParams = function getCustomParams() {
// get the correct file name if such a name already exists
DocManager.prototype.getCorrectName = function getCorrectName(fileName, userAddress) {
- const baseName = fileUtility.getFileName(fileName, true); // get file name from the url without extension
+ // get file name from the url without extension
+ const maxName = configServer.get('maxNameLength');
+ const baseName = fileUtility.getFileName(fileName, true).substr(0, maxName)
+ + (fileName.length > maxName ? '[...]' : '');
const ext = fileUtility.getFileExtension(fileName); // get file extension from the url
let name = baseName + ext; // get full file name
let index = 1;
@@ -152,7 +155,7 @@ DocManager.prototype.saveFileData = function saveFileData(fileName, userid, user
// get full creation date of the document
const dateCreate = fileSystem.statSync(this.storagePath(fileName, address)).mtime;
const minutes = (dateCreate.getMinutes() < 10 ? '0' : '') + dateCreate.getMinutes().toString();
- const month = (dateCreate.getMonth() < 10 ? '0' : '') + (parseInt(dateCreate.getMonth().toString(), 10) + 1);
+ const month = (dateCreate.getMonth() < 9 ? '0' : '') + (parseInt(dateCreate.getMonth().toString(), 10) + 1);
const sec = (dateCreate.getSeconds() < 10 ? '0' : '') + dateCreate.getSeconds().toString();
const dateFormat = `${dateCreate.getFullYear()}-${month}-${dateCreate.getDate()} `
+ `${dateCreate.getHours()}:${minutes}:${sec}`;
diff --git a/web/documentserver-example/nodejs/views/editor.ejs b/web/documentserver-example/nodejs/views/editor.ejs
index 9ed86798..170208d9 100644
--- a/web/documentserver-example/nodejs/views/editor.ejs
+++ b/web/documentserver-example/nodejs/views/editor.ejs
@@ -336,11 +336,18 @@
}
};
+ var onDocumentReady = function(){
+ if (config.type === "mobile") {
+ document.getElementsByTagName("iframe")[0].style.height = window.innerHeight + "px";
+ }
+ };
+
config = {
<%- include("config") %>
};
config.events = {
"onAppReady": onAppReady,
+ "onDocumentReady": onDocumentReady,
"onDocumentStateChange": onDocumentStateChange,
"onError": onError,
"onOutdatedVersion": onOutdatedVersion,
@@ -386,20 +393,6 @@
}
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
- fixSize();
- };
-
- // get the editor sizes
- var fixSize = function () {
- if (config.type !== "mobile") {
- return;
- }
- var wrapEl = document.getElementsByClassName("form");
- if (wrapEl.length) {
- wrapEl[0].style.height = screen.availHeight + "px";
- window.scrollTo(0, -1);
- wrapEl[0].style.height = window.innerHeight + "px";
- }
};
const getFileExt = function (fileName) {
@@ -411,10 +404,8 @@
if (window.addEventListener) {
window.addEventListener("load", connectEditor);
- window.addEventListener("resize", fixSize);
} else if (window.attachEvent) {
window.attachEvent("onload", connectEditor);
- window.attachEvent("onresize", fixSize);
}
diff --git a/web/documentserver-example/php/src/functions.php b/web/documentserver-example/php/src/functions.php
index 0ca7e08f..25912d68 100644
--- a/web/documentserver-example/php/src/functions.php
+++ b/web/documentserver-example/php/src/functions.php
@@ -475,11 +475,12 @@ function getFileInfo($fileId)
function GetCorrectName($fileName, $userAddress = null)
{
$pathParts = pathinfo($fileName);
-
+ $maxName = 50;
$ext = mb_strtolower($pathParts['extension']);
$name = $pathParts['basename'];
// get file name from the basename without extension
- $baseNameWithoutExt = mb_substr($name, 0, mb_strlen($name) - mb_strlen($ext) - 1);
+ $baseNameWithoutExt = mb_substr(mb_substr($name, 0, mb_strlen($name) - mb_strlen($ext) - 1), 0, $maxName)
+ . (strlen($fileName) > $maxName ? "[...]" : "");
$name = $baseNameWithoutExt . "." . $ext;
// if a file with such a name already exists in this directory
diff --git a/web/documentserver-example/python/src/utils/docManager.py b/web/documentserver-example/python/src/utils/docManager.py
index 9766ecf0..4ee33523 100755
--- a/web/documentserver-example/python/src/utils/docManager.py
+++ b/web/documentserver-example/python/src/utils/docManager.py
@@ -86,7 +86,8 @@ def getTemplateImageUrl(fileType, request):
# get file name with an index if such a file name already exists
def getCorrectName(filename, req):
- basename = fileUtils.getFileNameWithoutExt(filename)
+ maxName = 50
+ basename = fileUtils.getFileNameWithoutExt(filename)[0:maxName] + ('','[...]')[len(filename) > maxName]
ext = fileUtils.getFileExt(filename)
name = f'{basename}{ext}'
diff --git a/web/documentserver-example/ruby/.bundler-version b/web/documentserver-example/ruby/.bundler-version
new file mode 100644
index 00000000..b0f6bf0c
--- /dev/null
+++ b/web/documentserver-example/ruby/.bundler-version
@@ -0,0 +1 @@
+2.4.10
diff --git a/web/documentserver-example/ruby/.gitignore b/web/documentserver-example/ruby/.gitignore
index d3b3b04c..96a27689 100644
--- a/web/documentserver-example/ruby/.gitignore
+++ b/web/documentserver-example/ruby/.gitignore
@@ -1,3 +1,4 @@
+.bundle
bin
db
log
diff --git a/web/documentserver-example/ruby/Makefile b/web/documentserver-example/ruby/Makefile
index 13bc94d6..78bb6f85 100644
--- a/web/documentserver-example/ruby/Makefile
+++ b/web/documentserver-example/ruby/Makefile
@@ -22,6 +22,8 @@ help: # Show help message for each of the Makefile recipes.
awk 'BEGIN {FS = ": # "}; {printf "%s: %s\n", $$1, $$2}'
.PHONY: dev
+dev: \
+ export BUNDLE_WITH := development:doc:test
dev: # Install development dependencies and initialize the project.
@bundle install
@bundle exec rake app:update:bin
@@ -30,8 +32,10 @@ ifeq ($(SORBET_SUPPORTED),1)
endif
.PHONY: prod
+prod: \
+ export BUNDLE_WITHOUT := development:doc:test
prod: # Install production dependencies.
- @bundle install --without development doc test
+ @bundle install
@bundle exec rake app:update:bin
.PHONY: server-dev
diff --git a/web/documentserver-example/ruby/app/models/document_helper.rb b/web/documentserver-example/ruby/app/models/document_helper.rb
index 28982c03..2bb9b9f0 100755
--- a/web/documentserver-example/ruby/app/models/document_helper.rb
+++ b/web/documentserver-example/ruby/app/models/document_helper.rb
@@ -149,8 +149,10 @@ class DocumentHelper
# get the correct file name if such a name already exists
def get_correct_name(file_name, user_address)
+ maxName = 50
ext = File.extname(file_name) # get file extension
- base_name = File.basename(file_name, ext) # get file name without extension
+ # get file name without extension
+ base_name = File.basename(file_name, ext)[0...maxName] + (file_name.length > maxName ? '[...]' : '')
name = base_name + ext.downcase # get full file name
index = 1