Default content is loading on a Docx

I have used docker version onlyoffice on my linux machine. I have configured as mentioned. I can able to create a docx but, it is not creating a blank docx instead it has some pre contents on it which is same as a welcome page.

and also, if i try to create some other file types means, it is showing error like below

“a error has occured while opening the the file. the file content corresponds to text document (docx) but has inconsistent pptx”

how can i resolve this ?

hey @yokesh!

wow, what exactly did you change and which guide did you follow to do it?

Hi @Nikolas

sudo docker run -i -t -d -p 8050:80 --restart=always -v onlyoffice_docx_volume:/var/lib/onlyoffice/documentserver-example/files -v /app/onlyoffice/DocumentServer/logs:/var/log/onlyoffice -v /app/onlyoffice/DocumentServer/data:/var/www/onlyoffice/Data -v /app/onlyoffice/DocumentServer/lib:/var/lib/onlyoffice -v /app/onlyoffice/DocumentServer/db:/var/lib/postgresql -e JWT_SECRET=my_jwt_secret onlyoffice/documentserver

this is the command i ran, and when i open the onlyoffice in brower with url as “localhost:8050” and also ran those example commands. Now I can able to create documents but I got warning and error as

If I change my ip from localhost to machine ip, it is working fine. This was one issue.

I downloaded python example from “ONLYOFFICE Api Documentation - Language-specific examples”, followed the Readme file in it. below is config

import os

VERSION = ‘1.5.1’

FILE_SIZE_MAX = 5242880
STORAGE_PATH = ‘/var/lib/docker/volumes/onlyoffice_docx_volume/_data/192.xxx.x.xxx/’

DOC_SERV_FILLFORMS = [".oform", “.docx”]
DOC_SERV_VIEWED = [".pdf", “.djvu”, “.xps”, “.oxps”] # file extensions that can be viewed
DOC_SERV_EDITED = [".docx", “.xlsx”, “.csv”, “.pptx”, “.txt”, “.docxf”] # file extensions that can be edited
DOC_SERV_CONVERT = [ # file extensions that can be converted
“.docm”, “.doc”, “.dotx”, “.dotm”, “.dot”, “.odt”,
“.fodt”, “.ott”, “.xlsm”, “.xlsb”, “.xls”, “.xltx”, “.xltm”,
“.xlt”, “.ods”, “.fods”, “.ots”, “.pptm”, “.ppt”,
“.ppsx”, “.ppsm”, “.pps”, “.potx”, “.potm”, “.pot”,
“.odp”, “.fodp”, “.otp”, “.rtf”, “.mht”, “.html”, “.htm”, “.xml”, “.epub”, “.fb2”
]

DOC_SERV_TIMEOUT = 120000

DOC_SERV_SITE_URL = ‘http://192.xxx.x.xxx:8050/

DOC_SERV_CONVERTER_URL = ‘ConvertService.ashx’
DOC_SERV_API_URL = ‘web-apps/apps/api/documents/api.js’
DOC_SERV_PRELOADER_URL = ‘web-apps/apps/api/documents/cache-scripts.html’
DOC_SERV_COMMAND_URL=‘coauthoring/CommandService.ashx’

EXAMPLE_DOMAIN = “http://192.xxx.x.xxx:8050

DOC_SERV_JWT_SECRET = ‘my_jwt_secret’ # the secret key for generating token
DOC_SERV_JWT_HEADER = ‘Authorization’

DOC_SERV_VERIFY_PEER = False

EXT_SPREADSHEET = [
“.xls”, “.xlsx”, “.xlsm”, “.xlsb”,
“.xlt”, “.xltx”, “.xltm”,
“.ods”, “.fods”, “.ots”, “.csv”
]

EXT_PRESENTATION = [
“.pps”, “.ppsx”, “.ppsm”,
“.ppt”, “.pptx”, “.pptm”,
“.pot”, “.potx”, “.potm”,
“.odp”, “.fodp”, “.otp”
]

EXT_DOCUMENT = [
“.doc”, “.docx”, “.docm”,
“.dot”, “.dotx”, “.dotm”,
“.odt”, “.fodt”, “.ott”, “.rtf”, “.txt”,
“.html”, “.htm”, “.mht”, “.xml”,
“.pdf”, “.djvu”, “.fb2”, “.epub”, “.xps”, “.oxps”, “.oform”
]

LANGUAGES = {
‘en’: ‘English’,
‘hy’: ‘Armenian’,
‘az’: ‘Azerbaijani’,
‘eu’: ‘Basque’,
‘be’: ‘Belarusian’,
‘bg’: ‘Bulgarian’,
‘ca’: ‘Catalan’,
‘zh’ : ‘Chinese (People’s Republic of China)’,
‘zh-TW’ : ‘Chinese (Traditional, Taiwan)’,
‘cs’: ‘Czech’,
‘da’: ‘Danish’,
‘nl’: ‘Dutch’,
‘fi’: ‘Finnish’,
‘fr’: ‘French’,
‘gl’: ‘Galego’,
‘de’: ‘German’,
‘el’: ‘Greek’,
‘hu’: ‘Hungarian’,
‘id’: ‘Indonesian’,
‘it’: ‘Italian’,
‘ja’: ‘Japanese’,
‘ko’: ‘Korean’,
‘lv’: ‘Latvian’,
‘lo’: ‘Lao’,
‘ms’: ‘Malay (Malaysia)’,
‘nb’: ‘Norwegian’,
‘pl’: ‘Polish’,
‘pt’ : ‘Portuguese (Brazil)’,
‘pt-PT’ : ‘Portuguese (Portugal)’,
‘ro’: ‘Romanian’,
‘ru’: ‘Russian’,
‘sk’: ‘Slovak’,
‘sl’: ‘Slovenian’,
‘es’: ‘Spanish’,
‘sv’: ‘Swedish’,
‘tr’: ‘Turkish’,
‘uk’: ‘Ukrainian’,
‘vi’: ‘Vietnamese’,
‘aa-AA’: ‘Test Language’
}

if os.environ.get(“EXAMPLE_DOMAIN”): # generates a link for example domain
EXAMPLE_DOMAIN = os.environ.get(“EXAMPLE_DOMAIN”)
if os.environ.get(“DOC_SERV”): # generates links for document server
DOC_SERV_SITE_URL = os.environ.get(“DOC_SERV”)

How i got that default content in docx ?

I commented out the callbackurl in /edit of “action.py” and changed the return statement of getDownloadUrl as
def getDownloadUrl(filename, req, isServerUrl = True):
host = getServerUrl(isServerUrl, req)
curAdr = f’&userAddress={req.META[“REMOTE_ADDR”]}’ if isServerUrl else “”
#return f’{host}/download?fileName={filename}{curAdr}’
return f’{host}’

Thanks for the response !

@yokesh
I apologize for the late response(

Try using the server ip 192.168. … when running python example…
image

It looks like the problem is in the local network settings with docker (using a virtual machine).
Using ip addresses 192.168… should work out correctly.

The easiest way is to reinstall the Python example or change the value of action.py to the original ones.

Hello!

I have something error like this. On the separate virtual machine run a Docker with OnlyOffice (open source). I have a two project what use it. Django-based Web API project open and save document successful but it is very old project. Yii2-based Web API project will replace previous API. But I see warning message about ‘The document could not be saved’ if open file in Yii2-based project.
Each of project use similar views with iframe and generate config. Python project genered configuration like this:

var connectEditor = function () {

        config = {
"type": "desktop", 
"documentType": "slide", 
"document": {
  "title": "filename.pptx", 
  "url": "https://storage.yandexcloud.net/ligarobotov-methodical-test/documents/3/8/9/zagriaznenie_musorom_lsh2020__552d2dd6-0bb6-4b48-9d06-2ca6849faec4.pptx?AWSAccessKeyId=<KeyId?&Signature=<Signature>&Expires=1699353409", 
  "fileType": "pptx", 
  "key": "-7879767301923523783", 
  "info": {
    "owner": "Unknown", 
    "uploaded": "07.11.2023 10:31:49"
  }, 
  "permissions": {
    "comment": true, 
    "download": true, 
    "edit": true, 
    "fillForms": true, 
    "modifyFilter": true, 
    "modifyContentControl": true, 
    "review": true
  }
}, "editorConfig": {
  "actionLink": null, 
  "mode": "edit", 
  "lang": "ru", 
  "region": "ru-RU", 
  "callbackUrl": "https://delta.ligarobotov.ru/api/methodology/onlyoffice/track/?key=documents/3/8/9/filename.pptx&file_secret=<S3 Secret>&token=Bearer%<JWT-bearer>",
  "user": {
    "id": "1", 
    "name": "login 1"
  }, 
  "embedded": {
    "saveUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "embedUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "shareUrl": "https://storage.yandexcloud.net/path/filename.pptx?AWSAccessKeyId=<KeyId>&Signature=<Signature>&Expires=1699353409",
    "toolbarDocked": "top"
  },
  "customization": {
    "about": true, 
    "feedback": true, 
    "compactHeader": true, 
    "plugins": true, 
    "compactToolbar": true, 
    "goback": {
      "url": "https://delta.ligarobotov.ru/franchise/methodology/admin/lessons/9"
    }
   }
  }
}
            config.width = "100%";
        config.height = "100%";
        config.events = {
            'onAppReady': onAppReady,
            'onDocumentStateChange': onDocumentStateChange,
            'onRequestEditRights': onRequestEditRights,
            'onError': onError,
            'onOutdatedVersion': onOutdatedVersion,
            'onMakeActionLink': onMakeActionLink,
        };

        
        console.log(config)
        docEditor = new DocsAPI.DocEditor("iframeEditor", config);

        fixSize();
    };

PHP project generate configuration like this:

var connectEditor = function () {

        config = {"type":"desktop","documentType":"word","parentOrigin":"https:\/\/127.0.0.1:10075\/","document":{"title":"41f8d18a-ee2d-4c28-874f-7b2a875afb74.docx","url":"https:\/\/storage.yandexcloud.net\/delta-is-methodology-v2\/documents\/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>","fileType":"docx","key":"<Key>","info":{"owner":"Unknown","uploaded":"07.11.2023 07:48:32"},"permissions":{"comment":true,"download":true,"edit":true,"fillForms":true,"modifyFilter":true,"modifyContentControl":true,"review":true}},"editorConfig":{"mode":"edit","lang":"ru","region":"ru-RU","callbackUrl":"https:\/\/dev-delta.ligarobotov.ru\/methodology\/editor\/track\/?key=documents\/doc.docx&type=2&token=<JWT Bearer>","user":{"id":"102","name":"doc"},"embedded":{"saveUrl":"https:\/\/storage.yandexcloud.net\/delta-is-methodology-v2\/documents\/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>","embedUrl":"https:\/\/storage.yandexcloud.net\/delta-is-methodology-v2\/documents\/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>","shareUrl":"https:\/\/storage.yandexcloud.net\/delta-is-methodology-v2\/documents\/doc.docx?X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=<Credential>&X-Amz-Date=20231107T074832Z&X-Amz-SignedHeaders=host&X-Amz-Expires=1200&X-Amz-Signature=<Signature>","toolbarDocked":"top"},"customization":{"about":true,"feedback":true,"compactHeader":true,"plugins":true,"compactToolbar":true,"goBack":{"url":"http:\/\/127.0.0.1:10075\/methodology\/admin\/documents\/view\/1"}}}};
        config.width = "100%";
        config.height = "100%";
        config.events = {
            'onAppReady': onAppReady,
            'onDocumentStateChange': onDocumentStateChange,
            'onRequestEditRights': onRequestEditRights,
            'onError': onError,
            'onOutdatedVersion': onOutdatedVersion,
            'onMakeActionLink': onMakeActionLink,
        };

        console.log(config)
        docEditor = new DocsAPI.DocEditor("iframeEditor", config);

        fixSize();
    };

I’m not see a critical difference between this configurations. Can you?

Thanks for any help,
Dmitry

hi @DEMo

Sorry I didn’t notice your post… :face_with_peeking_eye:

Have you already resolved the issue?
Check if the link to the file specified in the document.url is correct. The link must be accessible from the document editing service.

You can also check more detailed information in the document server logs.

Hi!

No, I’m not resolved it at now. I will try check document.url, thanks for assumption. I written if it get something result.

Hi!

PHP SDK for S3 can’t add X-Amz-Expires to URL by default and it is curious. Thanks for your idea, I fix a direct access to file but by browser only.( I was not lose warning ‘file document save fail’ after this fix. Can it be problem with callbackUrl or embedded link (I use one for each embedded case), you think?

hey @DEMo :hugs:

Can I ask you to create a new topic?
It’s not very convenient to navigate through all this information to understand the problem. Please copy all your information into a new topic and provide a link to this topic.

Thank you!

Hi!

Yes, it’s not a problem. Is a correct name for topic is Migrate desktop OnlyOffice config from Django to Yii2 application or Migrate desktop OnlyOffice configuration between web-apps?

On your choice