Skip to content
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

[3.0] _normalizePath and _replaceTokens break paths on WAMP #68

Open
tomws opened this issue Jan 25, 2011 · 0 comments
Open

[3.0] _normalizePath and _replaceTokens break paths on WAMP #68

tomws opened this issue Jan 25, 2011 · 0 comments

Comments

@tomws
Copy link

tomws commented Jan 25, 2011

I'm having trouble with _normalizePath and _replaceTokens and image paths when developing on WAMP.

Uploading a file causes the file path to be stored with an absolute Windows path. For example, using a 'dir' setting of 'uploads/{ModelName}' and uploading the file 'myfile.jpg' saves the 'dir' data as C:\wamp\www\my_app_name\app\webroot\uploads\my_model_name\myfile.jpg. The file is saved to the correct location, but Apache cannot display an image from that absolute path. If I comment out the call to _normalizePath on line 95 (inside the setup function, commit 14d1467... I think), I'm able to solve part of the problem. The path saves as a relative "uploads\my_model_name" and I can build a path from which Apache can display the images.

The other part of the problem deals with _replaceTokens (line 555 of the same commit) forcefully overwriting manually entered directory separators. If it would only replace the tokens, my dir path above with "/" would be fine, but the function replaces both forward and back slashed with the system's DS - in this case, a Windows backslash. That would seem to be beyond desired capability, imho. To fix this problem, I had to comment out the last two parameters of the search and replace arrays in _replaceToken's str_replace function, as below:
return str_replace(
array('{ModelName}', '{fieldName}', '{DS}'),//, '/', ''),
array(Inflector::underscore($model->name), $fieldName, DS),//, DS, DS),
$string
);

I'm unsure if this is an inherent problem with developing on a Windows system, or if it's a problem with meio_upload's path handling. Can someone advise how the situation should be handled?

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

No branches or pull requests

1 participant