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

Transform text/uri-list mime values in data transfers #165768

Merged
merged 2 commits into from Nov 10, 2022

Conversation

mjbvz
Copy link
Contributor

@mjbvz mjbvz commented Nov 8, 2022

Fixes #165636

This passes any text/uri-list mime values in a datatransfer through our uri transformers. Because these uri values are stored as a list of strings, they are not automatically transformed

@mjbvz mjbvz added this to the November 2022 milestone Nov 8, 2022
@mjbvz mjbvz self-assigned this Nov 8, 2022
Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest to not use the uri transformer but to extract uri'ish data as URI-instances so that the conversion happens. You can use Markdown#from as inspiration for this.

@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 9, 2022

Thanks @jrieken. I switched to a different approach. Please re-review when you have a chance!

@@ -1966,7 +1967,7 @@ export namespace ViewBadge {
}

export namespace DataTransferItem {
export function toDataTransferItem(item: extHostProtocol.DataTransferItemDTO, resolveFileData: () => Promise<Uint8Array>): types.DataTransferItem {
export function to(mime: string, item: extHostProtocol.DataTransferItemDTO, resolveFileData: () => Promise<Uint8Array>, uriTransformer?: IURITransformer): types.DataTransferItem {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a lone uriTransformer argument

jrieken
jrieken previously approved these changes Nov 10, 2022
@mjbvz mjbvz merged commit 0308afc into microsoft:main Nov 10, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dragging an image into markdown adds the wrong path
3 participants