Skip to content

Commit a96dda7

Browse files
committed
URL handling
Signed-off-by: Clemens Vasters <clemens@vasters.com>
1 parent 62f1072 commit a96dda7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

avrotize/jsonstoavro.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import json
22
import os
3-
import re
4-
import sys
5-
import traceback
63
from typing import Any, Dict, List, Tuple
74
import jsonpointer
85
from jsonpointer import JsonPointerException
96
import requests
107
import copy
8+
9+
import urllib
1110
from avrotize.common import avro_name, avro_namespace, find_schema_node, generic_type, set_schema_node
1211
from avrotize.dependency_resolver import inline_dependencies_of, sort_messages_by_dependencies
1312
from urllib.parse import ParseResult, urlparse, unquote
@@ -496,7 +495,8 @@ def compose_uri(self, base_uri, url):
496495
filename = os.path.join(dir, url.path)
497496
file_uri = f'file://{filename}'
498497
else:
499-
file_uri = os.path.join(os.path.dirname(url), url.path)
498+
# combine the base URI with the URL
499+
file_uri = urllib.parse.urljoin(base_uri, url.geturl())
500500
return file_uri
501501

502502
def get_field_type_name(self, field: dict) -> str:

0 commit comments

Comments
 (0)