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

Files access via routes is broken after recent Grav refactoring #794

Closed
maxlysenko opened this issue Apr 18, 2016 · 9 comments
Closed

Files access via routes is broken after recent Grav refactoring #794

maxlysenko opened this issue Apr 18, 2016 · 9 comments
Labels

Comments

@maxlysenko
Copy link
Contributor

If a page has files accessed via routes, the files are not loaded.
Loading those files directly throws an error:

Whoops\Exception\ErrorException thrown with message "call_user_func_array() expects parameter 1 to be a valid callback, no array or string given"

For test example I have two folders: grav_test1 and grav_test2.
The first one contains develop before refactoring, the second one contains the latest develop. Both with default Antimatter theme.
Content of the user folder is the same in both folders:
I put test_image.png file into the pages\01.home folder (next to the default.md file).
Then in the default.md file I added the following line referring test image:

---
title: Home

---
<img src="home/test_image.png" alt="Test Image">

# Grav is Running!
...

Then load the pages in browser:
local.dev/grav_test1/ --> image is loaded fine on the page
local.dev/grav_test2/ --> image is not loaded

When trying to access files directly:
local.dev/grav_test1/home/test_image.png --> image is loaded fine
local.dev/grav_test2/home/test_image.png --> throws an error

The same is true for any files accessed via routes.

@flaviocopes
Copy link
Contributor

develop before refactoring means? Which commit are you on?

@rhukster
Copy link
Member

i just tested really quick and got another error with the fallback stuff. So definitely an issue that needs to be looked at.

@rhukster rhukster added the bug label Apr 18, 2016
@flaviocopes
Copy link
Contributor

Wondering when this regression happened

@maxlysenko
Copy link
Contributor Author

Hello,
By refactoring I mean the series of commits (e.g. b86a9ef, 7edb382, 1f49bee, 7051dad, 6f91e27, 1d2c4ea) for Grav.php from #745 which I think was merged in 9eeb4c1.
So "before refactoring" it is any commit before this merge.
In particular for my tests I've used commit a8f4092 as "before refactoring" and the latest commit 6124f71 as "after refactoring".

@flaviocopes
Copy link
Contributor

Replicated. I wasn't getting this issue previously because I didn't merge the latest develop changes in the feature branch I was working on.

@rhukster
Copy link
Member

the problem I get is related the fallbackUrl() method in Grav object needs to be changed from protected to public. You are getting a different error from what I saw, but ultimately it could be related.

@rhukster
Copy link
Member

Here's that change: dc121e9

Please test with this and let me know if your issue persists.

@maxlysenko
Copy link
Contributor Author

With dc121e9 all went back to normal. Files are loaded fine again.
Thank you Andy and all Grav team for your work, for always quick response on issues and for the great CMS!

@rhukster
Copy link
Member

cool :) Closing!

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

No branches or pull requests

3 participants