pryv / app-web

(Deprecated) Pryv for the web a.k.a. ‘the browser’
0 stars 2 forks source link

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

Open perki opened 6 years ago

perki commented 6 years ago

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}