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
[This appears to be a general problem with stone unions that point to a scalar (string, etc.) rather than a struct or other union; for example, dropboxQt::files::LookupError::toJson has the same issue with the malformed_path scalar. The reason why WriteMode poses a problem, and LookupError does not, is that no-one uses dropboxQt to encode a LookupError, because they only occur in results; WriteMode_UPDATE is unique (I think) in being a non-void union that is used in request parameters, via CommitInfo, in requests such as files/upload.]
While writing code to upload a file to Dropbox using dropboxQt::Files::FilesRoutes::upload, using a WriteMode instance tagged WriteMode_UPDATE in CommitInfo to specify the rev of the existing server copy to be updated, I encountered a couple of issues:
The WriteMode class has no setter for the m_update (rev) member that is required in the WriteMode_UPDATE union. (Creating a derived class WriteModeUpdate seemed like too much work, so, on to Update ApiUtil.h #2.)
I added a setter for its m_update member. Then, when CommitInfo::toJson calls the WriteMode::toJson method, the latter mis-encodes the m_update (rev) value by putting it inside the CommitInfo node as a scalar rather than a tagged node.
This code works for the WriteMode_ADD and WriteMode_OVERWRITE modes only because they are void unions and so it's acceptable to encode mode as a string value inside the CommitInfo node. However, as shown in the Dropbox API v2 Explorer example for files/upload (https://www.dropbox.com/developers/documentation/http/documentation#files-upload), in the WriteMode_UPDATE case, mode has to be a tagged JSON node containing an update (rev) string value. The current dropboxQt code does not produce this; see this screenshot from Qt Creator's debugger, showing the mis-encoded CommitInfo, with an update value beside mode, not inside.
If this were a general stone issue, I would expect it to have been fixed, so could this problem be peculiar to the stone interpreter you used to create dropboxQt?
How should I work around this so that I can program a file upload in WriteMode_UPDATE mode that the server will accept?
The text was updated successfully, but these errors were encountered:
[This appears to be a general problem with stone unions that point to a scalar (string, etc.) rather than a struct or other union; for example, dropboxQt::files::LookupError::toJson has the same issue with the malformed_path scalar. The reason why WriteMode poses a problem, and LookupError does not, is that no-one uses dropboxQt to encode a LookupError, because they only occur in results; WriteMode_UPDATE is unique (I think) in being a non-void union that is used in request parameters, via CommitInfo, in requests such as files/upload.]
While writing code to upload a file to Dropbox using dropboxQt::Files::FilesRoutes::upload, using a WriteMode instance tagged WriteMode_UPDATE in CommitInfo to specify the rev of the existing server copy to be updated, I encountered a couple of issues:
This code works for the WriteMode_ADD and WriteMode_OVERWRITE modes only because they are void unions and so it's acceptable to encode mode as a string value inside the CommitInfo node. However, as shown in the Dropbox API v2 Explorer example for files/upload (https://www.dropbox.com/developers/documentation/http/documentation#files-upload), in the WriteMode_UPDATE case, mode has to be a tagged JSON node containing an update (rev) string value. The current dropboxQt code does not produce this; see this screenshot from Qt Creator's debugger, showing the mis-encoded CommitInfo, with an update value beside mode, not inside.
If this were a general stone issue, I would expect it to have been fixed, so could this problem be peculiar to the stone interpreter you used to create dropboxQt?
How should I work around this so that I can program a file upload in WriteMode_UPDATE mode that the server will accept?
The text was updated successfully, but these errors were encountered: