Enhance download options and improve git error handling (#100)

* Fix download dialog to show gitignored paths with opt-in selection

- Add getIgnoredPathsList API to detect gitignored files from git root
- Fix git check-ignore to run from proper git root directory
- Add ignored paths checkboxes in download dialog for opt-in inclusion
- Support includeGit and includePaths options in download endpoints
- Fix dialog button event handling to prevent page reload

* Add clone timeout and improve git error handling

* Refactor path extraction in download-zip endpoint
This commit is contained in:
Chris Scott authored and GitHub committed 2026-01-31 09:39:45 -05:00
1 parent a02f7a2e98
commit eccd49e877
12 files changed
+542 -121

No files matched your search

@@ -33,15 +33,15 @@ export const FileBrowserSheet = memo(function FileBrowserSheet({ isOpen, onClose
const [currentPath, setCurrentPath] = useState<string>(basePath || '.')
const [downloadDialog, setDownloadDialog] = useState<{ type: 'directory' | 'repository' } | null>(null)
const containerRef = useRef<HTMLDivElement>(null)
const { bind, swipeStyles } = useSwipeBack(onClose, {
enabled: isOpen && !isEditing,
})
useEffect(() => {
return bind(containerRef.current)
}, [bind])
useEffect(() => {
if (isOpen) {
setShouldRender(true)
@@ -75,14 +75,14 @@ export const FileBrowserSheet = memo(function FileBrowserSheet({ isOpen, onClose
}
}, [repoName, basePath])
const handleDownloadDirectory = useCallback(async () => {
const handleDownloadDirectory = useCallback(async (options: { includeGit?: boolean, includePaths?: string[] }) => {
if (!currentPath) return
await downloadDirectoryAsZip(currentPath)
await downloadDirectoryAsZip(currentPath, options)
}, [currentPath])
const handleDownloadRepo = useCallback(async () => {
const handleDownloadRepo = useCallback(async (options: { includeGit?: boolean, includePaths?: string[] }) => {
if (!repoId || !repoName) return
await downloadRepo(repoId, repoName)
await downloadRepo(repoId, repoName, options)
}, [repoId, repoName])
const handleOpenDownloadDialog = (type: 'directory' | 'repository') => {
@@ -116,7 +116,7 @@ export const FileBrowserSheet = memo(function FileBrowserSheet({ isOpen, onClose
if (!isOpen && !shouldRender) return null
return (
<div
<div
ref={containerRef}
className="fixed inset-0 z-50"
style={{
@@ -193,6 +193,7 @@ export const FileBrowserSheet = memo(function FileBrowserSheet({ isOpen, onClose
? 'This will create a ZIP archive of the current directory and all its contents.'
: 'This will create a ZIP archive of the entire repository.'}
itemName={downloadDialog?.type === 'directory' ? currentPath.split('/').pop() || 'Directory' : repoName || 'Repository'}
targetPath={downloadDialog?.type === 'directory' ? currentPath : basePath}
/>
</div>
)