mirror of
https://github.com/Zie619/n8n-workflows.git
synced 2025-11-25 19:37:52 +08:00
Fix: download, detail, diagram workflows dir resove failed
This commit is contained in:
@@ -204,9 +204,13 @@ async def get_workflow_detail(filename: str):
|
|||||||
|
|
||||||
workflow_meta = workflows[0]
|
workflow_meta = workflows[0]
|
||||||
|
|
||||||
|
# file_path = Path(__file__).parent / "workflows" / workflow_meta.name / filename
|
||||||
|
# print(f"当前工作目录: {workflow_meta}")
|
||||||
# Load raw JSON from file
|
# Load raw JSON from file
|
||||||
file_path = os.path.join("workflows", filename)
|
workflows_path = Path('workflows')
|
||||||
if not os.path.exists(file_path):
|
json_files = list(workflows_path.rglob("*.json"))
|
||||||
|
file_path = [f for f in json_files if f.name == filename][0]
|
||||||
|
if not file_path.exists():
|
||||||
print(f"Warning: File {file_path} not found on filesystem but exists in database")
|
print(f"Warning: File {file_path} not found on filesystem but exists in database")
|
||||||
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
||||||
|
|
||||||
@@ -226,7 +230,9 @@ async def get_workflow_detail(filename: str):
|
|||||||
async def download_workflow(filename: str):
|
async def download_workflow(filename: str):
|
||||||
"""Download workflow JSON file."""
|
"""Download workflow JSON file."""
|
||||||
try:
|
try:
|
||||||
file_path = os.path.join("workflows", filename)
|
workflows_path = Path('workflows')
|
||||||
|
json_files = list(workflows_path.rglob("*.json"))
|
||||||
|
file_path = [f for f in json_files if f.name == filename][0]
|
||||||
if not os.path.exists(file_path):
|
if not os.path.exists(file_path):
|
||||||
print(f"Warning: Download requested for missing file: {file_path}")
|
print(f"Warning: Download requested for missing file: {file_path}")
|
||||||
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
||||||
@@ -246,8 +252,11 @@ async def download_workflow(filename: str):
|
|||||||
async def get_workflow_diagram(filename: str):
|
async def get_workflow_diagram(filename: str):
|
||||||
"""Get Mermaid diagram code for workflow visualization."""
|
"""Get Mermaid diagram code for workflow visualization."""
|
||||||
try:
|
try:
|
||||||
file_path = os.path.join("workflows", filename)
|
workflows_path = Path('workflows')
|
||||||
if not os.path.exists(file_path):
|
json_files = list(workflows_path.rglob("*.json"))
|
||||||
|
file_path = [f for f in json_files if f.name == filename][0]
|
||||||
|
print(f'{file_path}')
|
||||||
|
if not file_path.exists():
|
||||||
print(f"Warning: Diagram requested for missing file: {file_path}")
|
print(f"Warning: Diagram requested for missing file: {file_path}")
|
||||||
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
raise HTTPException(status_code=404, detail=f"Workflow file '{filename}' not found on filesystem")
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
3
context/unique_categories.json
Normal file
3
context/unique_categories.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[
|
||||||
|
"Uncategorized"
|
||||||
|
]
|
||||||
@@ -434,8 +434,9 @@ class WorkflowDatabase:
|
|||||||
if not os.path.exists(self.workflows_dir):
|
if not os.path.exists(self.workflows_dir):
|
||||||
print(f"Warning: Workflows directory '{self.workflows_dir}' not found.")
|
print(f"Warning: Workflows directory '{self.workflows_dir}' not found.")
|
||||||
return {'processed': 0, 'skipped': 0, 'errors': 0}
|
return {'processed': 0, 'skipped': 0, 'errors': 0}
|
||||||
|
workflows_path = Path(self.workflows_dir)
|
||||||
json_files = glob.glob(os.path.join(self.workflows_dir, "*.json"))
|
json_files = list(workflows_path.rglob("*.json"))
|
||||||
|
# json_files = glob.glob(os.path.join(self.workflows_dir, "*.json"), recursive=True)
|
||||||
|
|
||||||
if not json_files:
|
if not json_files:
|
||||||
print(f"Warning: No JSON files found in '{self.workflows_dir}' directory.")
|
print(f"Warning: No JSON files found in '{self.workflows_dir}' directory.")
|
||||||
|
|||||||
Reference in New Issue
Block a user