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

Editor: avoid error when mediadir does not exist #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vmauge
Copy link

@vmauge vmauge commented Sep 17, 2013

Some apps do not have a media dir under static/apps/<app_name> for
example eyeball and hello_coder. When you try to edit the apps with app
editor, there is an error display in the consol. The fix checks if the
folder exists before reading it.

Error in the conle is :

16 Sep 23:20:46 - GET: edit/hello_coder editor
16 Sep 23:20:47 - GET: api/metadata/get/hello_coder editor
16 Sep 23:20:47 - GET: api/media/list/hello_coder editor
Error: ENOENT, no such file or directory '/Users/vincent/dev/coder/coder-base/static/apps/hello_coder/media/'
    at Object.fs.readdirSync (fs.js:654:18)
    at Object.exports.listMedia (/Users/vincent/dev/coder/coder-base/apps/editor/app.js:338:20)
    at Object.exports.api_media_list_handler (/Users/vincent/dev/coder/coder-base/apps/editor/app.js:107:21)
    at apphandler (/Users/vincent/dev/coder/coder-base/server.js:111:46)
    at /Users/vincent/dev/coder/coder-base/server.js:255:60
    at callbacks (/Users/vincent/dev/coder/coder-base/node_modules/express/lib/router/index.js:161:37)
    at param (/Users/vincent/dev/coder/coder-base/node_modules/express/lib/router/index.js:135:11)
    at pass (/Users/vincent/dev/coder/coder-base/node_modules/express/lib/router/index.js:142:5)
    at Router._dispatch (/Users/vincent/dev/coder/coder-base/node_modules/express/lib/router/index.js:170:5)
    at Object.router (/Users/vincent/dev/coder/coder-base/node_modules/express/lib/router/index.js:33:10)
16 Sep 23:20:47 - GET: api/getcode/hello_coder editor

Some apps do not have a media dir under static/apps/<app_name> for
example eyeball and hello_coder. When you try to edit the apps with app
editor, there is an error display in the consol. The fix checks if the
folder exists before reading it.
@jmstriegel
Copy link
Contributor

all apps need, and should have at installation, a media directory. i think some were wiped by accident since git ignores empty directories. i'm doing some restructuring that should eliminate this problem.

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.

None yet

2 participants