Skip to content

Conversation

martijnvdp
Copy link

@martijnvdp martijnvdp commented Aug 7, 2025

We have an issue with terraform not downloading our private modules from gitlab when we do it from a location that uses the azure entra application proxy in between.

After investigation it seems that the response.contentlength is 0 in the header and the download gets skipped
it presumes the file already exists and continues to try to extract the empty archive

if headResp.Header.Get("Accept-Ranges") == "bytes" && headResp.ContentLength >= 0 {

changing the condition from headResp.ContentLength >= 0 to
headResp.ContentLength > 0 resolves the issue for us

seems that azure proxy doesnt set the content length correctly

PCI review checklist

  • I have documented a clear reason for, and description of, the change I am making.

  • If applicable, I've documented a plan to revert these changes if they require more than reverting the pull request.

  • If applicable, I've documented the impact of any changes to security controls.

    Examples of changes to security controls include using new access control methods, adding or removing logging pipelines, etc.

@martijnvdp martijnvdp requested a review from a team as a code owner August 7, 2025 15:46
@martijnvdp martijnvdp force-pushed the fix--download-file-when-resp-header-content-size-is-0 branch from adff051 to ade8cef Compare August 19, 2025 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant