Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore invalid range in blob download #2462

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

cnaj
Copy link

@cnaj cnaj commented Sep 4, 2024

Fix #2458, based on #2461

I'm not sure how to provoke an invalid range header in the unit tests; @blueww can you give me a hint?

@cnaj
Copy link
Author

cnaj commented Sep 5, 2024

@microsoft-github-policy-service agree company="corpuls"

@blueww
Copy link
Member

blueww commented Sep 6, 2024

@EmmaZhu

Do you have any idea how to input a invalid range header like "0--1" in download blob API by JS SDK (in Azurite test)?

@EmmaZhu
Copy link
Member

EmmaZhu commented Sep 10, 2024

Following is sample to set a customized header to a blobClient instance:

// Define a PipelinePolicy to set a customized header
export const injectorPolicyName = "injectorPolicy";

export function injectorPolicy(): PipelinePolicy {
  return {
    name: injectorPolicyName,
    async sendRequest(request: PipelineRequest, next: SendRequest): Promise<PipelineResponse> {
      request.headers.set('headername', `headervalue`);
      return next(request);
    },
  };
}
    // Insert the policy to pipeline in blobClient's contenxt
    const injector = injectorPolicy();

    const pipeline: Pipeline = (blobClient as any).storageClientContext.pipeline;
    pipeline.addPolicy(injector, {phase: 'Retry'});

   // code against blobClient

@blueww
Copy link
Member

blueww commented Sep 11, 2024

@cnaj
Would you please look at the sample code from Emma for how to add customized header when send request with JS storage SDK, and follow up it to add the test case?

@cnaj
Copy link
Author

cnaj commented Sep 12, 2024

I'm still trying to figure out how to apply @EmmaZhu's suggestion. For instance, there is no pipeline property on blobClient.storageClientContext, as far as I can see in the debugger. Also, this is an undocumented feature for which I don't have enough information... Could you please clarify?

@blueww
Copy link
Member

blueww commented Sep 18, 2024

@EmmaZhu
Would you please look at the above comments, and share the info that @cnaj needed?
Thanks!

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.

Empty blob access error using Java SDK
3 participants