mirror of
https://github.com/yamadashy/repomix.git
synced 2025-06-11 00:25:54 +03:00
fix(website): Clear file input after selection to prevent re-selection issues
This commit is contained in:
@@ -99,6 +99,10 @@ export function useFileUpload(config: FileUploadConfig) {
|
||||
function clearSelection() {
|
||||
selectedItem.value = null;
|
||||
errorMessage.value = null;
|
||||
// Clear file input to prevent re-selection issues
|
||||
if (fileInput.value) {
|
||||
fileInput.value.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Validate and process files
|
||||
@@ -139,6 +143,11 @@ export function useFileUpload(config: FileUploadConfig) {
|
||||
// Update selection
|
||||
selectedItem.value = folderName || resultFile.name;
|
||||
|
||||
// Clear file input to prevent re-selection issues
|
||||
if (fileInput.value) {
|
||||
fileInput.value.value = '';
|
||||
}
|
||||
|
||||
return { success: true, result: resultFile };
|
||||
} catch (error) {
|
||||
const errorMsg = error instanceof Error ? error.message : 'Processing failed';
|
||||
|
||||
@@ -2,15 +2,19 @@ import JSZip from 'jszip';
|
||||
|
||||
export function useZipProcessor() {
|
||||
async function createZipFromFiles(files: File[], folderName: string): Promise<File> {
|
||||
const zip = new JSZip();
|
||||
try {
|
||||
const zip = new JSZip();
|
||||
|
||||
for (const file of files) {
|
||||
const path = file.webkitRelativePath || file.name;
|
||||
zip.file(path, file);
|
||||
for (const file of files) {
|
||||
const path = file.webkitRelativePath || file.name;
|
||||
zip.file(path, file);
|
||||
}
|
||||
|
||||
const zipBlob = await zip.generateAsync({ type: 'blob' });
|
||||
return new File([zipBlob], `${folderName}.zip`, { type: 'application/zip' });
|
||||
} catch (error) {
|
||||
throw new Error(`Failed to create ZIP file: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
||||
}
|
||||
|
||||
const zipBlob = await zip.generateAsync({ type: 'blob' });
|
||||
return new File([zipBlob], `${folderName}.zip`, { type: 'application/zip' });
|
||||
}
|
||||
|
||||
function validateZipFile(file: File): { valid: boolean; error?: string } {
|
||||
|
||||
Reference in New Issue
Block a user