Skip to content

fix: resolve image paths to absolute paths #1041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

crazywolf132
Copy link
Contributor

Description

This PR fixes issue #1010 where the --image flag was not working correctly. The problem was that the code was trying to read image files using the path as provided without resolving it to an absolute path, causing issues when the path was relative to the current working directory.

Changes

  • Modified the createInputItem function in codex-cli/src/utils/input-utils.ts to resolve relative image paths to absolute paths before attempting to read the file
  • Added a check to determine if the path is already absolute, and if not, resolve it relative to the current working directory
  • Updated the tests to verify that the path resolution works correctly

Testing

  • Added new test cases to verify both relative and absolute path handling
  • All linting and type checking tests pass

Related Issues

Fixes #1010

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The --image seems not working
1 participant