"Invalid File" error when trying to upload an avatar. Affects all users and all image file types.



  • I did not notice this while I was staging the site but now that we are live it was discovered that users cannot upload avatars. It gives an "Invalid FIle" error regardless of the file type or size.

    This appears in the terminal log:

    14/2 05:23 [795] - error: /api/user/lots-0-logs/uploadpicture
     Error: [[error:invalid-files]]
        at middleware.validateFiles (/opt/nodebb/src/middleware/middleware.js:108:15)
        at Layer.handle [as handle_request] (/opt/nodebb/node_modules/express/lib/router/layer.js:82:5)
        at next (/opt/nodebb/node_modules/express/lib/router/route.js:110:13)
        at Form.<anonymous> (/opt/nodebb/node_modules/connect-multiparty/index.js:101:9)
        at Form.EventEmitter.emit (events.js:117:20)
        at maybeClose (/opt/nodebb/node_modules/connect-multiparty/node_modules/multiparty/index.js:557:10)
        at endFlush (/opt/nodebb/node_modules/connect-multiparty/node_modules/multiparty/index.js:552:3)
        at WriteStream.<anonymous> (/opt/nodebb/node_modules/connect-multiparty/node_modules/multiparty/index.js:617:5)
        at WriteStream.EventEmitter.emit (events.js:117:20)
        at fs.js:1601:14
    

    A 500 Error appears in the browser console. Here are the details:

    Remote Address:173.236.248.188:80
    Request URL:http://forum.antergos.com/api/user/lots-0-logs/uploadpicture
    Request Method:POST
    Status Code:500 Internal Server Error
    Request Headersview source
    Accept:*/*
    Accept-Encoding:gzip, deflate
    Accept-Language:en-US,en;q=0.8,es;q=0.6
    Cache-Control:no-cache
    Connection:keep-alive
    Content-Length:25331
    Content-Type:multipart/form-data; boundary=----WebKitFormBoundarydFjQjP1ZxmA6xrbo
    Cookie:express.sid=s%3A_qw_9KMYChOMHC6l0fdDevj1b7LKnqCA.MJKxJamVHDxJ7mUoPypTrOG2AmA34aeXhx2TNlkk9rM
    Host:forum.antergos.com
    Origin:http://forum.antergos.com
    Pragma:no-cache
    Referer:http://forum.antergos.com/user/lots-0-logs/edit
    User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36
    x-csrf-token:de8F0HCi-UWwU_dUREF_CLYUdxTJ2ziFC-ig
    X-Requested-With:XMLHttpRequest
    Request Payload
    ------WebKitFormBoundarydFjQjP1ZxmA6xrbo
    Content-Disposition: form-data; name="userPhoto"; filename="tux_question.png"
    Content-Type: image/png
    
    
    ------WebKitFormBoundarydFjQjP1ZxmA6xrbo
    Content-Disposition: form-data; name="params"
    
    {}
    ------WebKitFormBoundarydFjQjP1ZxmA6xrbo--
    Response Headersview source
    Connection:keep-alive
    Content-Length:80
    Content-Type:application/json; charset=utf-8
    Date:Sat, 14 Feb 2015 05:31:39 GMT
    Server:nginx
    Vary:Accept-Encoding
    X-Frame-Options:SAMEORIGIN
    X-Powered-By:NodeBB
    

    and the response:

    {"path":"/api/user/lots-0-logs/uploadpicture","error":"[[error:invalid-files]]"}
    

    File uploading works fine for things within the admin like the site logo and category icons. They also work fine with posts. It seems that only the avatars are having the issue. Any ideas on what could be causing this?


  • Admin



  • @baris Thanks for the quick reply! I made the change but there is no change. The issue is the same 😞


  • Admin

    Did you restart the forum? I am still seeing the old template in your html

    upload-0b21a79f-7361-4861-bce2-38b47f5fb00f



  • @baris Yes, I did restart it several times. This is weird. Also, Since this morning I have received emails from almost 20 users saying that the password reset is not working. When they click the email link it tells them "invalid token". When I check the logs I see a csrf error. Could this be related or is it a separate issue? I am beginning to panic a little because I don't know what's the problem nor how to fix it 😟

    Here is the csrf error when the password reset email link is clicked:

    14/2 14:03 [1086] - info: [emailer.mailgun] Sent `reset` email to uid 389
    14/2 14:19 [1086] - error: /register
     Error: invalid csrf token
        at verifytoken (/opt/nodebb/node_modules/csurf/index.js:237:11)
        at csrf (/opt/nodebb/node_modules/csurf/index.js:100:7)
        at Layer.handle [as handle_request] (/opt/nodebb/node_modules/express/lib/router/layer.js:82:5)
        at next (/opt/nodebb/node_modules/express/lib/router/route.js:110:13)
        at Route.dispatch (/opt/nodebb/node_modules/express/lib/router/route.js:91:3)
        at Layer.handle [as handle_request] (/opt/nodebb/node_modules/express/lib/router/layer.js:82:5)
        at /opt/nodebb/node_modules/express/lib/router/index.js:267:22
        at Function.proto.process_params (/opt/nodebb/node_modules/express/lib/router/index.js:321:12)
        at next (/opt/nodebb/node_modules/express/lib/router/index.js:261:10)
        at Function.proto.handle (/opt/nodebb/node_modules/express/lib/router/index.js:166:3)
    14/2 14:19 [1086] - error: /login
     Error: invalid csrf token
        at verifytoken (/opt/nodebb/node_modules/csurf/index.js:237:11)
        at csrf (/opt/nodebb/node_modules/csurf/index.js:100:7)
        at Layer.handle [as handle_request] (/opt/nodebb/node_modules/express/lib/router/layer.js:82:5)
        at next (/opt/nodebb/node_modules/express/lib/router/route.js:110:13)
        at Route.dispatch (/opt/nodebb/node_modules/express/lib/router/route.js:91:3)
        at Layer.handle [as handle_request] (/opt/nodebb/node_modules/express/lib/router/layer.js:82:5)
        at /opt/nodebb/node_modules/express/lib/router/index.js:267:22
        at Function.proto.process_params (/opt/nodebb/node_modules/express/lib/router/index.js:321:12)
        at next (/opt/nodebb/node_modules/express/lib/router/index.js:261:10)
        at Function.proto.handle (/opt/nodebb/node_modules/express/lib/router/index.js:166:3)
    

  • Admin

    Your problems are most likely caused by the out of date templates, since you have a custom theme and vanilla/lavender was updated.

    Try changing back to lavender or vanilla and see if the problems are resolved then you can look at fixing your custom theme.



  • @baris I went through and made sure my custom theme includes the latest changes from lavender. That corrected many of the issues. However, password resets are still not working. I added an issue to github #2731 Do you have any ideas for what may be causing it? 😕


  • Global Moderator

    @Dustin-Falgout so, the password resets not working, I think, is a know issue


 

| |