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

Content resource don't allow send text files via REST #15934

Closed
bryanboza opened this issue Jan 31, 2019 · 5 comments

Comments

@bryanboza
Copy link
Contributor

commented Jan 31, 2019

We have problems to add new file assets or save content with any binary field when you try to send a text file via REST

Expected Behavior

We need to be able to save contentlets with any kind of field without problems

Current Behavior

When you try to send a text file, we are showing an invalid field error and we are unable to save the content.
SC: https://gist.github.com/bryanboza/589165add15f7ab1b592feff2afd02d4

FYI: If you try with any other file is working as expected.

Steps to Reproduce (for bugs)

To recreate you need to send via REST the file assets form values to this endpoint, using a txt file to the fileAsset value http://localhost:8080/api/content/publish/1

Your Environment

Tested on master // Oracle // FF

@bryanboza bryanboza added this to the Cody Current milestone Jan 31, 2019

@bryanboza bryanboza changed the title Content resource isn't allowing send text files via REST Content resource don't allow send text files via REST Jan 31, 2019

@jdotcms

This comment has been minimized.

Copy link
Contributor

commented Feb 21, 2019

This is layer 8, hehe
You can do this and works fine:

curl -v -u admin@dotcms.com:admin -X POST \
 http://localhost:8080/api/content/publish/1 \
 -H 'cache-control: no-cache' \
 -F 'json={
    contentType:'\''fileAsset'\'',
    hostFolder:'\''demo.dotcms.com'\'',
    title:'\''api008b.txt'\'',
    fileName:'\''api008b.txt'\''
};type=application/json' \
 -F 'file=@/Users/jsanca/Documents/tour-mexico.txt;type=application/plain'
@DrDizzle

This comment has been minimized.

Copy link

commented Feb 26, 2019

The problem seems to be processing the type text/*,
as application/plain does work, but text/plain does not. From our tests, the same goes for html. So, I'd assume it's about text/* in general.
Many clients prefer using text/* (Postamn will use it automatically for example).
I suggest enabling text/* types.

jdotcms added a commit that referenced this issue Mar 19, 2019

@jgambarios

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

PR: #16251

jdotcms added a commit that referenced this issue Mar 27, 2019

jgambarios added a commit that referenced this issue Mar 28, 2019

#15934 minor refactor for allowing all files (#16297)
* #16252 format source. Introduce format checker on build. Alter style … (#16288)

* #16252 format source. Introduce format checker on build. Alter style files

* #16252 remove unwanted file

* #16252 remove unwanted file

* Updating commit reference for src/main/enterprise

* try different location for checkstyle.xml

* Revert "#16252 format source. Introduce format checker on build. Alter style … (#16288)" (#16291)

This reverts commit 05f9082.

* Updating commit reference for src/main/enterprise

* #15934 minor refactor for allowing all files
@jgambarios

This comment has been minimized.

Copy link
Contributor

commented Mar 28, 2019

PR: #16297

@bryanboza

This comment has been minimized.

Copy link
Contributor Author

commented Apr 12, 2019

Fixed, tested on master after the last changes and now I'm unable to reproduce

@wezell wezell closed this Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.