You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since moving to Zope4/Python3 we're experiencing problems with cut/copy & paste actions because of the browsers cookie size restrictions to 4kB ... I made some investigations and want to share it here:
I've made new clean Plone 5.2.x/py3 installation, selected all items on the main level and you get this list of ids which OFS.CopySupport should compress for later saving in a cookie:
so the saved value for the cookie is 2.25 times larger.
In a project we have a folder with 20 items which id's are about 100 characters long and the compressed/quoted cookie was too large to save in the browser. Debug logs for the clipboard:
2020-06-18 13:44:17,041 INFO [OFS:671][waitress] json_bytes: 3467B
2020-06-18 13:44:17,041 INFO [OFS:673][waitress] squashed_bytes: 947B
2020-06-18 13:44:17,041 INFO [OFS:678][waitress] returned quoted cookie: 3801B
Has anybody an idea how to downsize the content of the cookie or even better: store the clipboard somewhere else than a cookie?
The text was updated successfully, but these errors were encountered:
...
and zlib compressed to 65 Bytes:
```
b'x^\x8b6\xd4Q\x88\x8eVR\xd2QP\n\xc8\xc9\xcfK5\x02\xb1\xd2\x8a\xf2\xf3Jt\x0b\x12\xd3S\x95b\x81\xd2h\xb2y\xa9\xe5\xc5\xd8\xc4S\xcbR\xf3J\xb0\xca\xf8\xa6\xe6&\xa5\x16\x01\xa5bc\x01\xb22\x1f\x12'
```
now it is quoted and returned ... for py3 additionally it gets decoded to a `latin-1` text before quoting.
"latin-1" encoding/decoding is the typical way to convert between a sequence
of bytes and text representing the same sequence of bytes.
It does not increase the length.
Thus, you should get the same length for Python2 and for Python3.
Quoting can be important.
The cookie value is transported to the browser together with
other information (parameters such as "domain", "path", "expires", ...).
The value must therefore not contain syntactically relevant characters.
The best way to achieve this is via quoting.
Url-quoting is not the best way to quote binary data
(such as compressed information). The value should instead be
base64 encoded.
Since moving to Zope4/Python3 we're experiencing problems with cut/copy & paste actions because of the browsers cookie size restrictions to 4kB ... I made some investigations and want to share it here:
I've made new clean Plone 5.2.x/py3 installation, selected all items on the main level and you get this list of ids which
OFS.CopySupport
should compress for later saving in a cookie:this gets encoded to a json_bytes string with 112 Bytes:
and zlib compressed to 65 Bytes:
now it is quoted and returned ... for py3 additionally it gets decoded to a
latin-1
text before quoting. After quoting its size is:so the saved value for the cookie is 2.25 times larger.
In a project we have a folder with 20 items which id's are about 100 characters long and the compressed/quoted cookie was too large to save in the browser. Debug logs for the clipboard:
Has anybody an idea how to downsize the content of the cookie or even better: store the clipboard somewhere else than a cookie?
The text was updated successfully, but these errors were encountered: