Asish Karthikeya Gogineni commited on
Commit
d1be9d3
·
1 Parent(s): 5d60881

fix: Allow absolute paths for file sources

Browse files

- Fixed regression where strip('/') removed leading slashes from /tmp/uploaded.zip
- Changed to rstrip('/') to only remove trailing slashes from URLs
- Ensures ZIP uploads work correctly

Files changed (1) hide show
  1. code_chatbot/universal_ingestor.py +2 -1
code_chatbot/universal_ingestor.py CHANGED
@@ -58,7 +58,8 @@ class UniversalIngestor(DataManager):
58
  def _detect_handler(self) -> DataManager:
59
  """Detects the type of input and returns the appropriate handler."""
60
  # Aggressive cleaning: strip whitespace, backslashes, and trailing slashes
61
- source = self.source.strip().strip('\\').strip('/')
 
62
 
63
  # Smart Extraction: If input looks like garbage (has spaces, long text), try to find a URL inside it
64
  if "github.com" in source and (" " in source or "\n" in source or "Error" in source):
 
58
  def _detect_handler(self) -> DataManager:
59
  """Detects the type of input and returns the appropriate handler."""
60
  # Aggressive cleaning: strip whitespace, backslashes, and trailing slashes
61
+ # FIXED: Use rstrip for slashes/backslashes to avoid stripping leading '/' from absolute paths like /tmp/file.zip
62
+ source = self.source.strip().rstrip('\\').rstrip('/')
63
 
64
  # Smart Extraction: If input looks like garbage (has spaces, long text), try to find a URL inside it
65
  if "github.com" in source and (" " in source or "\n" in source or "Error" in source):