Skip to content

Commit

Permalink
Revert "fix unmarshalling request error"
Browse files Browse the repository at this point in the history
This reverts commit 35be548.

Depending on whetther the document has pages, koreader sends payload with the following formats.

{"percentage":0.005,"device":"device_name","device_id":"B78EA04ACC3A453DBA220D720C0BE102","document":"348e34463a44ba68659fc6fe814a6778","progress":3}

{"percentage":1,"device":"device_name","device_id":"B78EA04ACC3A453DBA220D720C0BE102","document":"4eb484b229696cb39cd8fe5495aa1bbe","progress":"\/body\/DocFragment[30]\/body\/p\/img.0"}

We can not blindly unmarshal progress into int or string.
  • Loading branch information
contrun committed Feb 1, 2022
1 parent 35be548 commit 8a642e3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handledb.go
Expand Up @@ -40,7 +40,7 @@ type dbDocument struct {
Username string `db:"username"`
DocumentID string `db:"documentid"`
Percentage float64 `db:"percentage"`
Progress int64 `db:"progress"`
Progress string `db:"progress"`
Device string `db:"device"`
DeviceID string `db:"device_id"`
Timestamp int64 `db:"timestamp"`
Expand Down
2 changes: 1 addition & 1 deletion kosyncsrv.go
Expand Up @@ -22,7 +22,7 @@ type requestHeader struct {
type requestPosition struct {
DocumentID string `json:"document"`
Percentage float64 `json:"percentage"`
Progress int64 `json:"progress"`
Progress string `json:"progress"`
Device string `json:"device"`
DeviceID string `json:"device_id"`
}
Expand Down

0 comments on commit 8a642e3

Please sign in to comment.