@@ -153,7 +153,12 @@ def guess_url_file_extension(url):
153153 mimetypes .add_type ('application/vnd.geo+json' , '.json' , False )
154154
155155 _ , likely_ext = os .path .splitext (path )
156- bad_extensions = '' , '.cgi' , '.php' , '.aspx' , '.asp' , '.do'
156+ if likely_ext == '.gz' :
157+ _ , compressed_ext = os .path .splitext (path [:- 3 ])
158+ if compressed_ext :
159+ likely_ext = compressed_ext + likely_ext
160+
161+ bad_extensions = "" , ".cgi" , ".php" , ".aspx" , ".asp" , ".do"
157162
158163 if not query and likely_ext not in bad_extensions :
159164 #
@@ -315,18 +320,25 @@ def get_file_path(self, url, dir_path):
315320 @classmethod
316321 def fields_from_conform_function (cls , v ):
317322 fxn = v .get ('function' )
318- if fxn :
319- if fxn in ('join' , 'format' ):
320- return set (v ['fields' ])
321- elif fxn == 'chain' :
322- fields = set ()
323- user_vars = set ([v ['variable' ]])
324- for func in v ['functions' ]:
325- if isinstance (func , dict ) and 'function' in func :
326- fields |= cls .fields_from_conform_function (func ) - user_vars
327- return fields
328- else :
329- return set ([v .get ('field' )])
323+ if not fxn :
324+ return set ()
325+
326+ if fxn in ('join' , 'format' ):
327+ # Join and format functions are a list of fields
328+ return set (v ['fields' ])
329+ elif fxn == 'chain' :
330+ # Chain function is a list of functions that we should recurse into for field names
331+ fields = set ()
332+ user_vars = set ([v ['variable' ]])
333+ for func in v ['functions' ]:
334+ if isinstance (func , dict ) and 'function' in func :
335+ fields |= cls .fields_from_conform_function (func ) - user_vars
336+ return fields
337+ elif fxn == 'constant' :
338+ # Constant function doesn't use any fields
339+ return set ()
340+ else :
341+ return set ([v .get ('field' )])
330342
331343 @classmethod
332344 def field_names_to_request (cls , source_config ):
@@ -348,11 +360,17 @@ def field_names_to_request(cls, source_config):
348360 elif isinstance (v , list ):
349361 # It's a list of field names
350362 fields |= set (v )
351- else :
363+ elif isinstance (v , str ):
364+ # It's a direct field name mapping
352365 fields .add (v )
366+ # Note: We intentionally skip non-string scalar values (e.g., integers) because
367+ # Esri only supports string field names. Also, the 'accuracy' field can be
368+ # set to an integer constant (like 1) to indicate a fixed accuracy level,
369+ # rather than a field name to fetch from the source.
353370
354371 if fields :
355- return list (filter (None , sorted (fields )))
372+ # Remove any blank or None values
373+ return list (sorted (filter (None , fields )))
356374 else :
357375 return None
358376
0 commit comments