Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_by_custom_id method does not sanitize URL for request. #716

Open
reillyholbel opened this issue Mar 6, 2024 · 0 comments
Open

get_by_custom_id method does not sanitize URL for request. #716

reillyholbel opened this issue Mar 6, 2024 · 0 comments

Comments

@reillyholbel
Copy link

reillyholbel commented Mar 6, 2024

We encountered this issue when importing a very old dataset with strange lookup fields that includes URL-unsafe characters into salesforce as an external ID field.

For instance:

salesforce.Account.get_by_custom_id("Custom_Field__c", 'B6042540754$FU>/ZAdv') will return a not found exception, even if the record was
previously created and has an external ID field 'Custom_Field__c' set to 'B6042540754$FU>/ZAdv'.

The fix for us was two changes in lines 12 and 828 of api.py:

In Line 12:
from urllib.parse import urljoin, urlparse, quote_plus

and In line 828 (get_by_custom_id)
custom_url = urljoin(self.base_url, f'{custom_id_field}/{quote_plus(custom_id)}')

Which escapes URL-unsafe characters appropriately.

Not sure if such a small change deserves its own PR. Just sharing what worked for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant