'use strict';

import { normalize } from 'path';

/**
 * resource check
 * @param  {}            
 * @return {}     []
 */
export default class extends think.middleware.base {
  /**
   * run
   * @return {Promise} []
   */
  run(){
    let pathname = this.http.pathname;
    if (!this.config('resource_on') || !pathname || pathname === '/') {
      return null;
    }
    pathname = decodeURIComponent(pathname).replace(/\\/g, '/');
    pathname = normalize(pathname);
    // replace \ to / on windows
    pathname = pathname.replace(/\\/g, '/');
    let reg = this.config('resource_reg');
    if (!reg.test(pathname)) {
      return null;
    }
    let file = normalize(`${think.RESOURCE_PATH}/${pathname}`);
    if(file.indexOf(think.RESOURCE_PATH) !== 0){
      return null;
    }
    //resource exist
    if (think.isFile(file)) {
      return file;
    }else{
      return true;
    }
  }
}
@@ -357,24 +357,35 @@
 null;%0A    %7D%0A
+    try%7B%0A  
     pathname
@@ -433,24 +433,64 @@
 %5C%5C/g, '/');%0A
+    %7Dcatch(e)%7B%0A      return null;%0A    %7D%0A
     pathname

Add try for decodeURIComponent