[PR #15534] fix: handle backslash-escaped spaces and tildes in CLI image paths #77486

Open
opened 2026-05-05 10:09:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15534
Author: @renezander030
Created: 4/13/2026
Status: 🔄 Open

Base: mainHead: fix/10333-cli-image-path


📝 Commits (1)

  • 4ee87ec fix: handle backslash-escaped spaces and tildes in CLI image paths

📊 Changes

2 files changed (+50 additions, -3 deletions)

View changed files

📝 cmd/interactive.go (+16 -3)
📝 cmd/interactive_test.go (+34 -0)

📄 Description

Summary

  • Handle shell-escaped single quotes ('\'') in file paths from Linux drag-and-drop
  • Support tilde (~) prefix in file paths, expanding to user's home directory
  • Add regex support for ~/ path prefix so ~/Desktop/photo.png is recognized

Test plan

  • Existing TestExtractFilenames passes (Unix and Windows paths)
  • Existing TestExtractFileDataRemovesQuotedFilepath passes
  • Existing TestExtractFileDataWAV passes
  • New TestExtractFilenamesEscapedPaths covers:
    • macOS drag-and-drop paths with \ and \~ (e.g. Mobile\ Documents/com\~apple\~CloudDocs)
    • Linux single-quoted paths with spaces
    • Linux single-quoted paths with embedded single quotes ('\'')
    • Tilde home directory expansion (~/Desktop/photo.png)

Fixes #10333


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/15534 **Author:** [@renezander030](https://github.com/renezander030) **Created:** 4/13/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/10333-cli-image-path` --- ### 📝 Commits (1) - [`4ee87ec`](https://github.com/ollama/ollama/commit/4ee87ec7e88aad56ae48b09857a0a7676c394142) fix: handle backslash-escaped spaces and tildes in CLI image paths ### 📊 Changes **2 files changed** (+50 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `cmd/interactive.go` (+16 -3) 📝 `cmd/interactive_test.go` (+34 -0) </details> ### 📄 Description ## Summary - Handle shell-escaped single quotes (`'\''`) in file paths from Linux drag-and-drop - Support tilde (`~`) prefix in file paths, expanding to user's home directory - Add regex support for `~/` path prefix so `~/Desktop/photo.png` is recognized ## Test plan - [x] Existing `TestExtractFilenames` passes (Unix and Windows paths) - [x] Existing `TestExtractFileDataRemovesQuotedFilepath` passes - [x] Existing `TestExtractFileDataWAV` passes - [x] New `TestExtractFilenamesEscapedPaths` covers: - macOS drag-and-drop paths with `\ ` and `\~` (e.g. `Mobile\ Documents/com\~apple\~CloudDocs`) - Linux single-quoted paths with spaces - Linux single-quoted paths with embedded single quotes (`'\''`) - Tilde home directory expansion (`~/Desktop/photo.png`) Fixes #10333 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 10:09:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#77486