This is a Fork of https://github.com/Duanyll/paste-and-upload
VSCode Paste S3

中文文档 | 日本語ドキュメント | 한국어 문서
This extension allows you to paste images (or files) directly from your clipboard (or from filesystem), upload them to a S3 (or S3 compatible endpoint) bucket, then insert link(s) pointing to the images(or files). It utilizes the DocumentPaste and DocumentDrop API and works on remote workspaces. This extension also supports forcePathStyle for path style access to S3-compatible storage like MinIO.
Features
- Fetch images from clipboard with VS Code API, even in remote workspaces. No extra hotkeys required, simply press
Ctrl+V to paste images!

- Or drag and drop images from your file explorer or browser

- Language overridable snippets for inserting links (Built-in support for Markdown and LaTeX)
- Upload images to any S3-compatible storage (Not limited to AWS S3, e.g. Aliyun OSS, Cloudflare R2, etc.)
- Or save images to your workspace (Supports virtual workspaces like Overleaf Workshop)

- Smart caching to avoid re-uploading identical files (based on content hash)
Requirements
Need VS Code 1.97 or later. No external dependencies are required, works across all platforms and remote workspaces.
Extension Settings
The S3 settings are required if you want to upload images to S3. You can configure them in your user settings (or workspace settings) like this:
{
"paste-s3.s3.region": "oss-cn-hongkong",
// If you are not using AWS S3, you need to set the endpoint
"paste-s3.s3.endpoint": "https://oss-cn-hongkong.aliyuncs.com",
"paste-s3.s3.accessKeyId": "YourAccessKeyId",
"paste-s3.s3.secretAccessKey": "YourSecretAccessKey",
"paste-s3.s3.bucket": "your-bucket-name",
// Will be prepended to S3 object key (Slashes will be preserved as is)
"paste-s3.s3.prefix": "img/",
// Will be prepended to inserted link (Slashes will be preserved as is)
"paste-s3.s3.publicUrlBase": "https://cdn.duanyll.com/img/",
// Force path style URLs for S3-compatible storage (e.g., MinIO)
"paste-s3.s3.forcePathStyle": true
}
It is recommended to configure S3 credentials in your user settings to avoid leaking them. After configuring S3 related options, you can press Ctrl+Shift+P and search for paste-s3: Test S3 Connection to verify your settings.
All settings are overridable by workspace settings. Settings directly belonging to paste-s3 section can be overriden by language-specific settings. For example, the following configuration will enable paste-s3 for Markdown and LaTeX, and upload images to S3 for Markdown and save images to workspace for LaTeX:
{
"paste-s3.enabled": false,
// Save as ${workspaceFolder}/figures/image.png
"paste-s3.workspace.path": "figures",
// Insert \includegraphics{image.png} (If you have \graphicspath{figures})
"paste-s3.workspace.linkBase": "",
"[markdown]": {
"paste-s3.enabled": true,
"paste-s3.uploadDestination": "s3"
},
"[latex]": {
"paste-s3.enabled": true,
"paste-s3.uploadDestination": "workspace"
}
}
A full list of settings can be found in the VS Code settings UI (search for paste-s3). Here are some notable settings:
| Name |
Description |
Default |
Default for Markdown |
paste-s3.enabled |
Enable or disable the extension |
true |
|
paste-s3.uploadDestination |
Where to upload images to |
s3 |
|
paste-s3.fileNamingMethod |
How to name the uploaded files |
md5short |
|
paste-s3.defaultSnippet |
The default snippet to insert |
$url |
[${1:$TM_SELECTED_TEXT}](https://github.com/latel/vscode-paste-s3/blob/HEAD/${url}) |
paste-s3.imageSnippet |
The snippet for images |
$url |
 |
paste-s3.mimeTypeFilter |
Regex to filter pasted files by MIME type |
"" |
|
paste-s3.ignoreWorkspaceFiles |
Ignore files already in workspace |
true |
|
This extension utilizes the native VS Code API to paste images, please also refer to the Paste As and Drop sections in the VS Code settings to control the behavior of pasting and dropping files, and the priority of this extension.
FAQ
Undoing paste operation by pressing Ctrl+Z can revert changes in the workspace, but the images are not deleted from S3. This is a limitation of VS Code API. We provide a workaround by adding a paste-s3: Undo Recent Upload command, which will show a list of recent uploads and allow you to manually select and delete them.
