Skip to content

Commit

Permalink
Merge pull request #26963 from tienifr/fix/26953
Browse files Browse the repository at this point in the history
[CP Staging] Fix: App crashes while creating Distance money request

(cherry picked from commit cced02d)
  • Loading branch information
mountiny authored and OSBotify committed Sep 7, 2023
1 parent 3c63780 commit cdbe26b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/ReportActionItem/ReportActionItemImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const propTypes = {
images: PropTypes.arrayOf(
PropTypes.shape({
thumbnail: PropTypes.string,
image: PropTypes.string,
image: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
}),
).isRequired,

Expand Down
2 changes: 1 addition & 1 deletion src/components/avatarPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ export default PropTypes.shape({
source: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
type: PropTypes.oneOf([CONST.ICON_TYPE_AVATAR, CONST.ICON_TYPE_WORKSPACE]),
name: PropTypes.string,
id: PropTypes.number,
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
});
2 changes: 1 addition & 1 deletion src/components/transactionPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export default PropTypes.shape({
/** The receipt object associated with the transaction */
receipt: PropTypes.shape({
receiptID: PropTypes.number,
source: PropTypes.string,
source: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
state: PropTypes.string,
}),

Expand Down
5 changes: 5 additions & 0 deletions src/libs/tryResolveUrlFromApiRoot.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ const ORIGIN_PATTERN = new RegExp(`^(${ORIGINS_TO_REPLACE.join('|')})`);
* @returns {String}
*/
export default function tryResolveUrlFromApiRoot(url) {
// in native, when we import an image asset, it will have a number representation which can be used in `source` of Image
// in this case we can skip the url resolving
if (typeof url === 'number') {
return url;
}
const apiRoot = ApiUtils.getApiRoot({shouldUseSecure: false});
return url.replace(ORIGIN_PATTERN, apiRoot);
}

0 comments on commit cdbe26b

Please sign in to comment.