@@ -1496,38 +1496,38 @@ func fetchODataMetadata(metadataUrl string) (metadata string, hash string, err e
14961496 return "" , "" , nil
14971497 }
14981498
1499- var body []byte
1500-
1501- // At this point, metadataUrl is already normalized by NormalizeURL() in createODataClient:
1502- // - Relative paths have been converted to absolute file:// URLs
1503- // - HTTP(S) URLs are unchanged
1504- // So we only need to distinguish file:// vs HTTP(S)
1505-
1506- filePath := pathutil .PathFromURL (metadataUrl )
1507- if filePath != "" {
1508- // Local file - read directly (path is already absolute)
1509- body , err = os .ReadFile (filePath )
1510- if err != nil {
1511- return "" , "" , mdlerrors .NewBackend (fmt .Sprintf ("read local metadata file %s" , filePath ), err )
1512- }
1513- } else {
1514- // HTTP(S) fetch
1515- client := & http.Client {Timeout : 30 * time .Second }
1516- resp , err := client .Get (metadataUrl )
1517- if err != nil {
1518- return "" , "" , mdlerrors .NewBackend (fmt .Sprintf ("fetch $metadata from %s" , metadataUrl ), err )
1519- }
1520- defer resp .Body .Close ()
1521-
1522- if resp .StatusCode != http .StatusOK {
1523- return "" , "" , mdlerrors .NewValidationf ("$metadata fetch returned HTTP %d from %s" , resp .StatusCode , metadataUrl )
1524- }
1525-
1526- body , err = io .ReadAll (resp .Body )
1527- if err != nil {
1528- return "" , "" , mdlerrors .NewBackend ("read $metadata response" , err )
1529- }
1530- }
1499+ var body []byte
1500+
1501+ // At this point, metadataUrl is already normalized by NormalizeURL() in createODataClient:
1502+ // - Relative paths have been converted to absolute file:// URLs
1503+ // - HTTP(S) URLs are unchanged
1504+ // So we only need to distinguish file:// vs HTTP(S)
1505+
1506+ filePath := pathutil .PathFromURL (metadataUrl )
1507+ if filePath != "" {
1508+ // Local file - read directly (path is already absolute)
1509+ body , err = os .ReadFile (filePath )
1510+ if err != nil {
1511+ return "" , "" , mdlerrors .NewBackend (fmt .Sprintf ("read local metadata file %s" , filePath ), err )
1512+ }
1513+ } else {
1514+ // HTTP(S) fetch
1515+ client := & http.Client {Timeout : 30 * time .Second }
1516+ resp , err := client .Get (metadataUrl )
1517+ if err != nil {
1518+ return "" , "" , mdlerrors .NewBackend (fmt .Sprintf ("fetch $metadata from %s" , metadataUrl ), err )
1519+ }
1520+ defer resp .Body .Close ()
1521+
1522+ if resp .StatusCode != http .StatusOK {
1523+ return "" , "" , mdlerrors .NewValidationf ("$metadata fetch returned HTTP %d from %s" , resp .StatusCode , metadataUrl )
1524+ }
1525+
1526+ body , err = io .ReadAll (resp .Body )
1527+ if err != nil {
1528+ return "" , "" , mdlerrors .NewBackend ("read $metadata response" , err )
1529+ }
1530+ }
15311531
15321532 // Hash calculation (same for both HTTP and local file)
15331533 metadata = string (body )
0 commit comments