Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.txt file format being changed on edit. #1067

Closed
sreejan-chowdhury opened this issue Nov 10, 2020 · 12 comments
Closed

.txt file format being changed on edit. #1067

sreejan-chowdhury opened this issue Nov 10, 2020 · 12 comments

Comments

@sreejan-chowdhury
Copy link

Do you want to request a feature or report a bug?
On editing a .txt file, the .txt file has openxml format data

What is the current behavior?
.txt file edited displays openxml raw data on being opened in a text editor. The data is displayed properly only when opened in Microsoft Word.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
Upload a .txt file. Edit it. Download the file and open it in a text editor.

What is the expected behavior?
.txt file format should not be changed.

Did this work in previous versions of DocumentServer?
NA

DocumentServer version:
6.1

Operating System:
MacOS

Browser version:
Firefox 82.0.2

@ShockwaveNN ShockwaveNN

@ShockwaveNN
Copy link
Contributor

Upload a .txt file. Edit it. Download the file and open it in a text editor.

Do not understand you, if you download file as txt it should download as txt

DocumentServer version:
6.1

Are you sure, we do not release 6.1 to general public yet, are you using testing version

@ShockwaveNN ShockwaveNN

Please do not call me directly, until 100% sure I will anser your question, I'm not only one handling issues on GitHub

@sreejan-chowdhury
Copy link
Author

sreejan-chowdhury commented Nov 10, 2020

DocumentServer version:
using latest onlyoffice image `onlyoffice/documentserver:latest

Deployed on :
Operating System:
Ubuntu 18

The file extension remains as .txt , but the file content is converted to openxml raw data when being opened in a text editor.

The files I worked on is herewith attached
Before editing:
docEditing.txt
After Editing:
image
docEditing.txt

@ShockwaveNN
Copy link
Contributor

Which DocumentServer integration with DMS are you using? Nextcloud, some other or your own?

If you're using your own - are you sure you're sending txt as fileType options?

@sreejan-chowdhury
Copy link
Author

sreejan-chowdhury commented Nov 10, 2020

I am trying it on my own.

The fileType is set to txt. The config that I am using is as follows:

var config = {
  "type": "desktop",
  "documentType": "text",
  "document": {
    "title": "docEditing.txt",
    "url": "https://xyz.com/service/docEditing.txt",
    "fileType": "txt",
    "key": "f6ccfc9e2",
    "permissions": {
      "comment": true,
      "download": true,
      "edit": true,
      "fillForms": true,
      "modifyFilter": true,
      "modifyContentControl": true,
      "review": true
    }
  },
  "editorConfig": {
    "mode": "edit",
    "callbackUrl": "https://xyz.com/service/docEditing.txt",
    "lang": "en",
    "user": {
      "id": "a017d463",
      "name": "testuser"
    },
    "customization": {
      "forcesave": false
    }
  },
  "token": "some token"
};

@sreejan-chowdhury
Copy link
Author

I tried uploading the .txt to https://personal.onlyoffice.com/Products/Files/default.aspx#1606623 and editing it.

On upload, the file extension is .txt
image

Edited the file:
image

After saving the edited file, I refreshed the view. The file extension was changed to .docx
image

@ShockwaveNN
Copy link
Contributor

@sreejan-chowdhury Yeah, I agree I can reproduce your case on personal, trying to figure it out

@ShockwaveNN
Copy link
Contributor

I asked our dev team and this is correct behavoir, any document after editing become ooxml
If you want to change it back to txt you should send it to convert service

This is a post about it in FAQ

@sreejan-chowdhury
Copy link
Author

Thanks. I have gone through the link.
My initial file format is txt and the final file format is also txt.
The Conversion API documentation specifies that txt to txt conversion is not supported.

@ShockwaveNN
Copy link
Contributor

@sreejan-chowdhury Yes, but after editing txt file in result you got docx file, and converting it back to txt is supported

@sreejan-chowdhury
Copy link
Author

That is true for https://personal.onlyoffice.com/Products/Files/default.aspx#1606623.

But the project that I have created does something different. On Save, the callback URL is called by document server. The doPost method that has been implemented for the callback, internally calls the document server to get the file (docEditing.txt).
On receiving the response, the InputStream from the response's content is stored to a file with the same name.

In this case there is no conversion of txt to docx.

@ShockwaveNN
Copy link
Contributor

I'm not very good at DocumentServer integration, but as far as I understand - there is no way to edit txt file, without converting it to docx. So you should handle this situation, if your integration trying to edit txt file - result always will be docx file, send it to convert service, get txt and overwrite previous result of docx

@ShockwaveNN
Copy link
Contributor

This issue was closed due to no response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants