academic/vipa

Server Error on IssueFile POST Request

memduhcagridemir opened this issue · 7 comments

We need to add some files to related issues. But OJS returns

{
  "error": {
    "code": 500,
    "message": "Internal Server Error"
  }
}

when we post a file to /api/v1/journal/1355/issue/23792/files.json

https://goo.gl/wZeObI

Could you test this again and send me the POST request body that you're using if it fails. I can't replicate the error.

hmert commented

@memduhcagridemir is it okey?

I did not have time to test it. I can probably check this on monday. @hmert

I created a small valid pdf file thanks to http://stackoverflow.com/questions/17279712/what-is-the-smallest-possible-valid-pdf

I am using it as an example to get smaller base64 string

This is the json I am posting to ojs.

{
    "file": {
        "filename": "imp-test.pdf",
        "encoded_content": "JVBERi0xLjAKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqIDIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iaiAzIDAgb2JqPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAzIDNdPj5lbmRvYmoKeHJlZgowIDQKMDAwMDAwMDAwMCA2NTUzNSBmCjAwMDAwMDAwMTAgMDAwMDAgbgowMDAwMDAwMDUzIDAwMDAwIG4KMDAwMDAwMDEwMiAwMDAwMCBuCnRyYWlsZXI8PC9TaXplIDQvUm9vdCAxIDAgUj4+CnN0YXJ0eHJlZgoxNDkKJUVPRg=="
    },
    "type": 0,
    "langCode": 1,
    "translations": {
        "tr": {
            "title": "Test"
        }
    }
}

And the actual post request

$ curl -H "Content-Type: application/json" -XPOST -d '{"file":{"filename":"imp-test.pdf","encoded_content":"JVBERi0xLjAKMSAwIG9iajw8L1R5cGUvQ2F0YWxvZy9QYWdlcyAyIDAgUj4+ZW5kb2JqIDIgMCBvYmo8PC9UeXBlL1BhZ2VzL0tpZHNbMyAwIFJdL0NvdW50IDE+PmVuZG9iaiAzIDAgb2JqPDwvVHlwZS9QYWdlL01lZGlhQm94WzAgMCAzIDNdPj5lbmRvYmoKeHJlZgowIDQKMDAwMDAwMDAwMCA2NTUzNSBmCjAwMDAwMDAwMTAgMDAwMDAgbgowMDAwMDAwMDUzIDAwMDAwIG4KMDAwMDAwMDEwMiAwMDAwMCBuCnRyYWlsZXI8PC9TaXplIDQvUm9vdCAxIDAgUj4+CnN0YXJ0eHJlZgoxNDkKJUVPRg=="},"type":0,"langCode":1,"translations":{"tr":{"title":"Test"}}}' http://dergipark.gov.tr/api/v1/journal/1355/issue/23792/files.json?apikey=XXX
{"error":{"code":500,"message":"Internal Server Error"}}

@memduhcagridemir You can supply a version value yourself until the related branch is merged to master.

Thank you @utkuaydin 👍

i merged related branch