Skip to content

Commit

Permalink
fix(bucketExplorer): copyFromContext selection
Browse files Browse the repository at this point in the history
  • Loading branch information
fangbinwei committed Jun 21, 2020
1 parent a618ab9 commit 319c620
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/commands/bucketExplorer/copyFromContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@ import { CommandContext } from '@/constant'
import { copyUri } from '@/uploader/copyUri'
import Logger from '@/utils/log'
import { showObjectNameInputBox } from '@/utils'
import path from 'path'

async function copyFromBucketExplorerContext(
treeItem: OSSObjectTreeItem
): Promise<void> {
const sourceUri = vscode.Uri.parse(treeItem.url)
const targetName = await showObjectNameInputBox(sourceUri.path)
const sourcePath = sourceUri.path

const targetName = await showObjectNameInputBox(sourceUri.path, {
valueSelection: [0, sourcePath.length - path.extname(sourcePath).length - 1]
})
if (!targetName) return
try {
await copyUri(vscode.Uri.file(targetName.trim()), sourceUri)
Expand Down

0 comments on commit 319c620

Please sign in to comment.