Openbravo Issue Tracking System - Retail Modules | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0051515 | Retail Modules | Web POS | public | 2023-01-31 12:46 | 2023-02-27 11:56 |
Reporter | gorkaion | ||||
Assigned To | ranjith_qualiantech_com | ||||
Priority | high | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | OS | 5 | OS Version | ||
Product Version | |||||
Target Version | Fixed in Version | RR23Q2 | |||
Merge Request Status | approved | ||||
Review Assigned To | |||||
OBNetwork customer | Gold | ||||
Support ticket | 54612 | ||||
Regression level | |||||
Regression date | |||||
Regression introduced in release | |||||
Regression introduced by commit | |||||
Triggers an Emergency Pack | No | ||||
Summary | 0051515: Wrong json encode on DS.Request when the json has a string value with the "/" character | ||||
Description | In the customer instance the issue is reproduced when scanning a document number that has the "/" character. This scan is calling a backend custom service using OB.DS.Request: new OB.DS.Request(customService).exec({param: "param/with/character}, callback, error) These executes a GET call to backend the json with the parameters is encoded using encodeURI in ob-datasource.js [1] This is not scaping the / character so it is sent as it is in the request. MobileService in backend manage this request. To get the parameters the service is executing a split of the url by "/" [2]. Since the original / is not encoded the split is wrong causing a failure initializing the JSONObject with the parameters. As a result the custom service is called with an empty JSONObject [1] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/web/org.openbravo.mobile.core/source/data/ob-datasource.js#L281 [^] [2] https://gitlab.com/openbravo/product/pmods/org.openbravo.mobile.core/-/blob/master/src/org/openbravo/mobile/core/process/MobileService.java#L168 [^] | ||||
Steps To Reproduce | Unknown how to execute in a clean POS. Any request to backend using OB.DS.Request().exec() with a parameter value containing the "/" should make it fail. Livebuilds Login POS Open Console and run below code var params = {}; params.sample = { a: 'X/X' }; params.bpartnerId = 'ABD91C9D3BC94175B876FBBE9CACA008'; params.bpLocationId = '2AA7EADDF7EC405899262DDA3E572436'; new OB.DS.Request('org.openbravo.retail.posterminal.master.LoadedCustomer').exec(params, async function(data) { console.log(data); }); Error will occur in request | ||||
Proposed Solution | Isntead of using encodeURI use encodeURIComponents to encode the json string. https://thisthat.dev/encode-uri-vs-encode-uri-component/ [^] And ENCODED_SLASH should be updated in Apache and Tomcat https://stackoverflow.com/questions/4390436/need-to-allow-encoded-slashes-on-apache [^] https://stackoverflow.com/questions/39931538/how-to-set-allow-encoded-slash-in-tomcat-8 [^] | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2023-01-31 12:46 | gorkaion | New Issue | |||
2023-01-31 12:46 | gorkaion | Assigned To | => Retail | ||
2023-01-31 12:46 | gorkaion | OBNetwork customer | => Gold | ||
2023-01-31 12:46 | gorkaion | Support ticket | => 54612 | ||
2023-01-31 12:46 | gorkaion | Triggers an Emergency Pack | => No | ||
2023-02-02 12:36 | ranjith_qualiantech_com | Assigned To | Retail => ranjith_qualiantech_com | ||
2023-02-03 10:23 | ranjith_qualiantech_com | Status | new => scheduled | ||
2023-02-06 07:49 | ranjith_qualiantech_com | Steps to Reproduce Updated | bug_revision_view_page.php?rev_id=25498#r25498 | ||
2023-02-06 07:49 | ranjith_qualiantech_com | Proposed Solution updated | |||
2023-02-07 05:46 | hgbot | Merge Request Status | => open | ||
2023-02-07 05:46 | hgbot | Note Added: 0146280 | |||
2023-02-27 11:55 | hgbot | Merge Request Status | open => approved | ||
2023-02-27 11:56 | hgbot | Resolution | open => fixed | ||
2023-02-27 11:56 | hgbot | Status | scheduled => closed | ||
2023-02-27 11:56 | hgbot | Note Added: 0147030 | |||
2023-02-27 11:56 | hgbot | Fixed in Version | => RR23Q2 | ||
2023-02-27 11:56 | hgbot | Note Added: 0147031 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|