andresgsaravia / research-engine

A platform in Google App Engine to facilitate reasearchers' life.
https://research-engine.appspot.com/
16 stars 12 forks source link

Uploading and editing a DataRevision produces errors in the description #124

Closed andresgsaravia closed 11 years ago

andresgsaravia commented 11 years ago

For some reason it truncates long lines and replaces the "newline" character with an = sign... this is strange indeed...

andresgsaravia commented 11 years ago

For example here

andresgsaravia commented 11 years ago

I'm guessing this has to do with the way the POST request is made...

andresgsaravia commented 11 years ago

This is a typical POST request:

[14:06:37.502] POST https://research-engine.appspot.com/_ah/upload/AMmfu6aPb10hdi8ua-LNaALkHqaaNI1UuGgzY2G7T5PJ44bcoLb7c4S6laSaxgGCQ0SluQPuVcXydWZPEpsw8Ru8s4DuCatSUE6WUn-32wjjGTHNV9niR2oB-rmBnkZb2KiT7IuqaBx5n1ZhwVjDCZfUCWCkddMPmZ89XOpgNK7xuwEfuH6jay3P6zMGLwoQwrtPMXQ24kYa/ALBNUaYAAAAAUXrScNLvBqlXSp3mqTFfz0P5cIXu62S3/ [HTTP/1.1 302 Found 1044ms]

And the body of such request

Content-Type: multipart/form-data; boundary=---------------------------84043137911302405341459797223

Content-Length: 1185

-----------------------------84043137911302405341459797223

Content-Disposition: form-data; name="meta"

Mean Raman phonons for the first 19 excited states.

The parameters used (in eV) are:

* Band energy:                          (0.5 -0.5 0.5)

* On-site repulsion:                    7

* Nn hopping:                           0.5

* Raman phonons:                        22

* Raman phonons energy:                 125/2014

* Raman shift:                          4/3

* Electron-Raman phonon coupling:       0

* Infrared phonons:                     22

* Infrared phonons energy:              0.07601787487586892

* Electron-infrared phonon coupling:    from 0 to 0.245

The basis file for this calculation is [this](https://research-engine.appspot.com/file/AMIfv95Kn8G7C8eEaD_sGKWzavWeLBy0DMExLpC9NMeLXdSj4b7DVOO2S_IW2Tubnnp5fLM9ATwiAI1El1Xkatbz-XVUgIX1EGioZDcEHfr_aZSKkAcoAdphe4VnGa1TzEFh3z0EVJvHa3DHtv_tJqqhu8SMLkcfAOLkIdTXIlvGpCaB8Hoq3IA)

-----------------------------84043137911302405341459797223

Content-Disposition: form-data; name="file"; filename=""

Content-Type: application/octet-stream

-----------------------------84043137911302405341459797223--

Nothing smells fishy here.

andresgsaravia commented 11 years ago

I can't reproduce this in the development server.

andresgsaravia commented 11 years ago

The UploadDataRevisionHandler receives the meta parameter already truncated (not in the development server). For example, if I write in the web form

Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque. Etiam luctus porttitor lorem, sed suscipit est rutrum non. Curabitur lobortis nisl a enim congue semper. Aenean commodo ultrices imperdiet. Vestibulum ut justo vel sapien venenatis tincidunt. Phasellus eget dolor sit amet ipsum dapibus condimentum vitae quis lectus. Aliquam ut massa in turpis dapibus convallis. Praesent elit lacus, vestibulum at malesuada et, ornare et est. Ut augue nunc, sodales ut euismod non, adipiscing vitae orci. 

and I make a logging statement in UploadDataRevisionHandler to print the meta parameter

meta = self.request.get("meta")
logging.debug(meta)

I get the following log:

Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque=
. Etiam luctus porttitor lorem, sed suscipit est rutrum non. Curabitur lobo=
rtis nisl a enim congue semper. Aenean commodo ultrices imperdiet. Vestibul=
um ut justo vel sapien venenatis tincidunt. Phasellus eget dolor sit amet i=
psum dapibus condimentum vitae quis lectus. Aliquam ut massa in turpis dapi=
bus convallis. Praesent elit lacus, vestibulum at malesuada et, ornare et e=
st. Ut augue nunc, sodales ut euismod non, adipiscing vitae orci. 

Even though I got the nice POST request

Content-Disposition: form-data; name="meta"

Suspendisse lectus leo, consectetur in tempor sit amet, placerat quis neque. Etiam luctus porttitor lorem, sed suscipit est rutrum non. Curabitur lobortis nisl a enim congue semper. Aenean commodo ultrices imperdiet. Vestibulum ut justo vel sapien venenatis tincidunt. Phasellus eget dolor sit amet ipsum dapibus condimentum vitae quis lectus. Aliquam ut massa in turpis dapibus convallis. Praesent elit lacus, vestibulum at malesuada et, ornare et est. Ut augue nunc, sodales ut euismod non, adipiscing vitae orci. 
andresgsaravia commented 11 years ago

I doesn't seem to be linked with the secure: always attribute from app.yaml since changing it to secure: never produces the same errors.

andresgsaravia commented 11 years ago

It seems I've hit a long-standing known bug.