Skip to content

[Storage] Custom domain support.#10771

Merged
jiacfan merged 10 commits intoAzure:masterfrom
jiacfan:custom_domain
Aug 25, 2020
Merged

[Storage] Custom domain support.#10771
jiacfan merged 10 commits intoAzure:masterfrom
jiacfan:custom_domain

Conversation

@jiacfan
Copy link
Member

@jiacfan jiacfan commented Aug 22, 2020

Support custom domain which targets to solve #9896 and #10520 .

@ghost ghost added the Storage Storage Service (Queues, Blobs, Files) label Aug 22, 2020
@ljian3377
Copy link
Member

ljian3377 commented Aug 24, 2020

The if (parsedUrl.getHost()!.split(".")[1] === "blob") part and the last else branch do the same handling. Then maybe we should combine them in a same branch?

      const parsedUrl = URLBuilder.parse(this.url);

      if (parsedUrl.getHost()!.split(".")[1] === "blob") {
        // "https://myaccount.blob.core.windows.net/containername/blob".
        // .getPath() -> /containername/blob
        const pathComponents = parsedUrl.getPath()!.match("/([^/]*)(/(.*))?");
        containerName = pathComponents![1];
        blobName = pathComponents![3];
      } else if (isIpEndpointStyle(parsedUrl)) {
        // IPv4/IPv6 address hosts... Example - http://192.0.0.10:10001/devstoreaccount1/containername/blob
        // Single word domain without a [dot] in the endpoint... Example - http://localhost:10001/devstoreaccount1/containername/blob
        // .getPath() -> /devstoreaccount1/containername/blob
        const pathComponents = parsedUrl.getPath()!.match("/([^/]*)/([^/]*)(/(.*))?");
        containerName = pathComponents![2];
        blobName = pathComponents![4];
      } else {
        // "https://customdomain.com/containername/blob".
        // .getPath() -> /containername/blob
        const pathComponents = parsedUrl.getPath()!.match("/([^/]*)(/(.*))?");
        containerName = pathComponents![1];
        blobName = pathComponents![3];
      }
``` #WontFix

@jiacfan jiacfan added the Client This issue points to a problem in the data-plane of the library. label Aug 24, 2020
@jiacfan
Copy link
Member Author

jiacfan commented Aug 24, 2020

Not combine by design, actually my first code version before PR is combined version, while I changed back to this splitted version for : 1) Reduce regression risk. 2) For ease of maintaining, other wise first branch will be (parsedUrl.getHost()!.split(".")[1] === "blob") || !isIpEndpointStyle(parsedUrl)), which might be not easy for other maintainers. 3) For extensibility, logically this parse logic could be extended further, so we might split existing else further.


In reply to: 678883200 [](ancestors = 678883200)

@jiacfan jiacfan merged commit 2f62dda into Azure:master Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Client This issue points to a problem in the data-plane of the library. Storage Storage Service (Queues, Blobs, Files)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants