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

Updating an event with an attachment in the browser re-upload the attachment to the event. #18

Open
perki opened this issue Dec 19, 2017 · 0 comments
Labels
bug Something isn't working question

Comments

@perki
Copy link
Member

perki commented Dec 19, 2017

This result in a re-adding the attachment to the event.

Steps to redo

  1. Upload a picture on Pryv from the Browser
  2. Select the resulting event and modify a property.

!! WARNING !!
This bug is reported in the "Browser" but it might be good to check that this is not a JS Lib bug first.

Debug track

Initial state of the event

{
  "streamId": "test",
  "time": 1513677399,
  "type": "picture/attached",
  "content": null,
  "tags": [
    
  ],
  "description": "",
  "created": 1513681201.919,
  "createdBy": "chr1vsavh0015btpn1pwl167r",
  "modified": 1513681201.919,
  "modifiedBy": "chr1vsavh0015btpn1pwl167r",
  "attachments": [
    {
      "id": "cjbdipedg083309mzfh3wj3gh",
      "fileName": "1pixel.jpg",
      "type": "image/jpeg",
      "size": 10114,
      "width": 1,
      "height": 1,
      "readToken": "cjbdipx1g083609mzl3c02ikm-xfi572FPZgGSnNzNJL019FfqCUY"
    }
  ],
  "id": "cjbdipedd083209mz0v9yqh5y"
}

After update

{
  "streamId": "test",
  "time": 1513677420,
  "type": "picture/attached",
  "content": null,
  "tags": [
    
  ],
  "description": "",
  "created": 1513681201.919,
  "createdBy": "chr1vsavh0015btpn1pwl167r",
  "modified": 1513681281.934,
  "modifiedBy": "chr1vsavh0015btpn1pwl167r",
  "attachments": [
    {
      "id": "cjbdipedg083309mzfh3wj3gh",
      "fileName": "1pixel.jpg",
      "type": "image/jpeg",
      "size": 10114,
      "width": 1,
      "height": 1,
      "readToken": "cjbdipx1g083609mzl3c02ikm-xfi572FPZgGSnNzNJL019FfqCUY"
    },
    {
      "id": "cjbdir440083b09mzsum7i5ky",
      "fileName": "1pixel.jpg",
      "type": "image/jpeg",
      "size": 10114,
      "readToken": "cjbdipx1g083609mzl3c02ikm-SoI9PRldmrODuU1qDqMxcQIO0Ik"
    }
  ],
  "id": "cjbdipedd083209mz0v9yqh5y"
}

Network traces of an update

Triggering an update from the browser create 2 HTTP requests 1 POST and 1 PUT, see after

First POST REQUEST

Request URL:https://perki.pryv.me/events/cjbdipedd083209mz0v9yqh5y
Request Method:POST
Status Code:200 OK
Remote Address:155.133.131.181:443
Referrer Policy:no-referrer-when-downgrade


Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
authorization:cj6dq5q8215q2ojpn64u5sxy5
Connection:keep-alive
Content-Length:10515
Content-Type:multipart/form-data; boundary=----WebKitFormBoundary4S54Ee9YsrZnKYQn
Cookie:i18next=fr
Host:perki.pryv.me
Origin:https://perki.pryv.me
Referer:https://perki.pryv.me/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36
X-Requested-With:XMLHttpRequest

------WebKitFormBoundary4S54Ee9YsrZnKYQn
Content-Disposition: form-data; name="1pixel"; filename="1pixel.jpg"
Content-Type: image/jpeg


------WebKitFormBoundary4S54Ee9YsrZnKYQn
Content-Disposition: form-data; name="event"

{"streamId":"test","time":1513677399,"type":"picture/attached","content":null,"tags":[""],"description":"","trashed":false}
------WebKitFormBoundary4S54Ee9YsrZnKYQn--

2nd PUT Request

Request URL:https://perki.pryv.me/events/cjbdipedd083209mz0v9yqh5y
Request Method:PUT
Status Code:200 OK
Remote Address:155.133.131.181:443
Referrer Policy:no-referrer-when-downgrade

Accept:*/*
Accept-Encoding:gzip, deflate, br
Accept-Language:fr-FR,fr;q=0.9,en-US;q=0.8,en;q=0.7
authorization:cj6dq5q8215q2ojpn64u5sxy5
Connection:keep-alive
Content-Length:147
Content-Type:application/json; charset=UTF-8
Cookie:i18next=fr
Host:perki.pryv.me
Origin:https://perki.pryv.me
Referer:https://perki.pryv.me/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36

{"streamId":"test","time":1513677420,"type":"picture/attached","content":null,"tags":[],"description":"","modified":1513681201.919,"trashed":false}
```
@perki perki added bug Something isn't working question labels Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working question
Projects
None yet
Development

No branches or pull requests

1 participant