cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in learning how media industry leaders use Dropbox Replay? Register for our webinar here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Seems like I am having security issues with my files when using sharing_get_shared_links

Seems like I am having security issues with my files when using sharing_get_shared_links

babydream
Helpful | Level 6
Go to solution

 

API sharing_get_shared_links succeeds when I first copy the link from the dropbox manually. It shows:
https://www.dropbox.com/s/pexagwz8il76t1k/Beach%20Vibes%20-%206x8%20-%20GO%20WEB.jpg?dl=0 on Copy Link
as well as in Python code. No difference.

 

The next entry in the folder fails to get sharing_get_shared_links without me manually doing a Copy Link.
The sharing_create_shared_link_with_settings returns:
CreateSharedLinkWithSettingsError('shared_link_already_exists', SharedLinkAlreadyExistsMetadata('metadata', FileLinkMetadata(client_modified=datetime.datetime(2022, 5, 26, 19, 42, 59), content_owner_team_info=NOT_SET, expires=NOT_SET, id='id:Fpt6TPwBUf0AAAAAAAA-Nw', link_permissions=LinkPermissions(allow_comments=False, allow_download=True, audience_options=[LinkAudienceOption(allowed=True, audience=LinkAudience('public', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('team', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('no_one', None), disallowed_reason=NOT_SET)],
can_allow_download=True, can_disallow_download=True, can_remove_expiry=True, can_remove_password=True, can_revoke=True, can_set_expiry=True, can_set_password=True, can_use_extended_sharing_controls=True, effective_audience=LinkAudience('public', None), link_access_level=LinkAccessLevel('viewer', None), requested_visibility=RequestedVisibility('public', None), require_password=False, resolved_visibility=ResolvedVisibility('public', None), revoke_failure_reason=NOT_SET, team_restricts_comments=False, visibility_policies=[VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('public', None), resolved_policy=AlphaResolvedVisibility('public', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('team_only', None), resolved_policy=AlphaResolvedVisibility('team_only', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('password', None), resolved_policy=AlphaResolvedVisibility('password', None))]), name='Beach Vibes - 6x8 - GO.jpg', path_lower='/test_app/beach vibes (go)/beach vibes - 6x8 - go.jpg', rev='602ac3dc075db6a49d3d3', server_modified=datetime.datetime(2023, 8, 11, 21, 17, 33), size=68850796, team_member_info=TeamMemberInfo(display_name='Spencer Treadwell', member_id='dbmid:AAD0RjvblA75FwxwxOysVcw5sM1X7rbEfXw', team_info=Team(id='dbtid:AABwTGjgmzPm2JVb_S_Pf5GBZ0wgZwZ2J9w', name='baby dream')), url='https://www.dropbox.com/scl/fi/7qfp06kxnj965fxgysk64/Beach-Vibes-6x8-GO.jpg?rlkey=hkvkhmvc4wtmog2mhr...')))

 

I then stop the program and and do a copy link of the failed sharing_get_shared_links within dropbox and get
https://www.dropbox.com/scl/fi/7qfp06kxnj965fxgysk64/Beach-Vibes-6x8-GO.jpg?rlkey=hkvkhmvc4wtmog2mhr... exactly as in the exception. Instead of a /s/ it has a /scl/fi meaning what? What is causing this and how can it be rectified?

Thank you in advance.
Cris Rodriguez

try:

shared_link_metadata = dbx.sharing_get_shared_links(path=save_product_path)
if shared_link_metadata.links:
iterator = iter(shared_link_metadata.links)
for item in iterator:
shared_link = item.url
else:
shared_link_metadata = dbx.sharing_create_shared_link_with_settings(
save_product_path)
shared_link = shared_link_metadata.url

 

1 Accepted Solution

Accepted Solutions

babydream
Helpful | Level 6
Go to solution

Gregg:

Sorry for the confusion, it seems the issues are not there any longer.   I ran the application several times without any problems.  So let's leave it as is and if I run into the issue again with different folders I will try to be much more explicit than before.

 

Thank you once again for your outstanding support.

Cris

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

First, please switch to sharing_list_shared_links instead of sharing_get_shared_links (since the latter is deprecated). The code for reading the URLs would work the same way.

 

If you're still seeing an issue when using sharing_list_shared_links, please let me know exactly how sharing_list_shared_links is failing for you (e.g., what error or unexpected output exactly do you get from it) so we can look into it.

babydream
Helpful | Level 6
Go to solution

First time I executed the Application the first folder was processed without a hitch but the second one threw an exception that the link couldn't be found or created.   I've decided to rerun the application and it ran successfully and once again successfully.  I am perplexed.  I need to have an answer since I am planning to change our operating procedures which this application is replacing.   We cannot have this happen in real time.  We would have to go back to manually get these shared links which takes forever. We process approximately 1200 links a day which is stored with our inventory in Shopify and Order Desk Processing.  Would appreciate an email to [removed per the Dropbox Community Guidelines] when this issue is resolved.   I am the COO and Developer for our firm and I can't move this application until this issue is resolved.   It started happening within the last two weeks while I was presenting the product to management and the application had the exception.  It never happened before with in the development environment.

 

The odd things about the links that are generated today is that the spaces are replaced by a dash.

 

Thank you again for your support and quick response.

Cristobal [removed]

 

Here's the content of the exception:

 


Date 0/28/2023 4:40 PM
try:

shared_link_metadata = dbx.sharing_list_shared_links(path=save_product_path)
if shared_link_metadata.links:
iterator = iter(shared_link_metadata.links)
for item in iterator:
shared_link = item.url
else:
shared_link_metadata = dbx.sharing_create_shared_link_with_settings(
save_product_path)
shared_link = shared_link_metadata.url

From the Application exception: (didn't find the sharing_list_shared_links nor it couldn't create it.
https://www.dropbox.com/scl/fi/t7knlgbwo8s7qpvm8dkxs/Beach-Vibes-Floor-8x8-GO-WEB.jpg?rlkey=dcfqougz...


From Dropbox Copylink:
https://www.dropbox.com/scl/fi/t7knlgbwo8s7qpvm8dkxs/Beach-Vibes-Floor-8x8-GO-WEB.jpg?rlkey=dcfqougz...

Copy of the exception:
CreateSharedLinkWithSettingsError('shared_link_already_exists', SharedLinkAlreadyExistsMetadata('metadata', FileLinkMetadata(client_modified=datetime.datetime(2023, 3, 12, 15, 3, 19), content_owner_team_info=NOT_SET, expires=NOT_SET, id='id:Fpt6TPwBUf0AAAAAAAA-YQ', link_permissions=LinkPermissions(allow_comments=False, allow_download=True, audience_options=[LinkAudienceOption(allowed=True, audience=LinkAudience('public', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('team', None), disallowed_reason=NOT_SET), LinkAudienceOption(allowed=True, audience=LinkAudience('no_one', None), disallowed_reason=NOT_SET)], can_allow_download=True, can_disallow_download=True, can_remove_expiry=True, can_remove_password=True, can_revoke=True, can_set_expiry=True, can_set_password=True, can_use_extended_sharing_controls=True, effective_audience=LinkAudience('public', None), link_access_level=LinkAccessLevel('viewer', None), requested_visibility=RequestedVisibility('public', None), require_password=False, resolved_visibility=ResolvedVisibility('public', None), revoke_failure_reason=NOT_SET, team_restricts_comments=False, visibility_policies=[VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('public', None), resolved_policy=AlphaResolvedVisibility('public', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('team_only', None), resolved_policy=AlphaResolvedVisibility('team_only', None)), VisibilityPolicy(allowed=True, disallowed_reason=NOT_SET, policy=RequestedVisibility('password', None), resolved_policy=AlphaResolvedVisibility('password', None))]), name='Beach Vibes Floor - 8x8 - GO WEB.jpg', path_lower='/test_app/beach vibes floor (go)/beach vibes floor - 8x8 - go web.jpg', rev='604014631aaaf6a49d3d3', server_modified=datetime.datetime(2023, 8, 28, 20, 9, 39), size=1327923, team_member_info=TeamMemberInfo(display_name='Spencer Treadwell', member_id='dbmid:AAD0RjvblA75FwxwxOysVcw5sM1X7rbEfXw', team_info=Team(id='dbtid:AABwTGjgmzPm2JVb_S_Pf5GBZ0wgZwZ2J9w', name='baby dream')), url='https://www.dropbox.com/scl/fi/t7knlgbwo8s7qpvm8dkxs/Beach-Vibes-Floor-8x8-GO-WEB.jpg?rlkey=dcfqougz...')))

 

Greg-DB
Dropbox Staff
Go to solution

Thanks for following up, however I'm having some trouble understanding your messages.

 

Are you getting any actual error or unexpected output from sharing_list_shared_links in particular? For instance, you said "From the Application exception: (didn't find the sharing_list_shared_links nor it couldn't create it.", but that doesn't seem to be text from an API exception. Can you please share the full error or unexpected output you're getting from that? Please also clarify what response you expected instead. Thanks!

 

As for the CreateSharedLinkWithSettingsError 'shared_link_already_exists' error, that would come from dbx.sharing_create_shared_link_with_settings in particular, and is expected if a shared link already exists for the specified item. That seems to be the case here, and the shared link you posted here does seem to be working.

babydream
Helpful | Level 6
Go to solution

Gregg:

Sorry for the confusion, it seems the issues are not there any longer.   I ran the application several times without any problems.  So let's leave it as is and if I run into the issue again with different folders I will try to be much more explicit than before.

 

Thank you once again for your outstanding support.

Cris

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    babydream Helpful | Level 6
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?