Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/app/api/proxy/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,20 @@ async function downloadFile(params: {
const { url, maxBytes, timeoutInSeconds } = params
const abortController = new AbortController()
const timeoutSignal = AbortSignal.timeout(timeoutInSeconds * 1000)
const response = await fetch(url, {
const headers: {[key: string]: string} = {}
// Extract basic auth from URL and construct an Authorization header instead.
if ((url.username && url.username.length > 0) || (url.password && url.password.length > 0)) {
const username = decodeURIComponent(url.username)
const password = decodeURIComponent(url.password)
headers["Authorization"] = "Basic " + btoa(`${username}:${password}`)
}
// Make sure basic auth is removed from URL.
const urlWithoutAuth = url
urlWithoutAuth.username = ""
urlWithoutAuth.password = ""
const response = await fetch(urlWithoutAuth, {
method: "GET",
headers,
signal: AbortSignal.any([abortController.signal, timeoutSignal])
})
if (!response.body) {
Expand Down
10 changes: 5 additions & 5 deletions src/features/sidebar/view/internal/primary/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PrimaryContainer = ({
}) => {
return (
<>
<_PrimaryContainer
<InnerPrimaryContainer
variant="temporary"
width={width}
isOpen={isOpen}
Expand All @@ -26,23 +26,23 @@ const PrimaryContainer = ({
sx={{ display: { xs: "block", sm: "none" } }}
>
{children}
</_PrimaryContainer>
<_PrimaryContainer
</InnerPrimaryContainer>
<InnerPrimaryContainer
variant="persistent"
width={width}
isOpen={isOpen}
keepMounted={false}
sx={{ display: { xs: "none", sm: "block" } }}
>
{children}
</_PrimaryContainer>
</InnerPrimaryContainer>
</>
)
}

export default PrimaryContainer

const _PrimaryContainer = ({
const InnerPrimaryContainer = ({
variant,
width,
isOpen,
Expand Down
8 changes: 5 additions & 3 deletions src/features/sidebar/view/internal/secondary/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ const SecondaryContainer = ({
const sx = { overflow: "hidden" }
return (
<>
<_SecondaryContainer
<InnerSecondaryContainer

sidebarWidth={isSM ? sidebarWidth : 0}
isSidebarOpen={isSM ? offsetContent: false}
sx={{ ...sx }}
>
{children}
</_SecondaryContainer>
</InnerSecondaryContainer
>
</>
)
}
Expand Down Expand Up @@ -52,7 +54,7 @@ const WrapperStack = styled(Stack, {
})
}))

const _SecondaryContainer = ({
const InnerSecondaryContainer = ({
sidebarWidth,
isSidebarOpen,
children,
Expand Down