Coder Social home page Coder Social logo

bottle's Introduction

假想情境是結果檔案會被放在特定目錄下,要寫個簡易下載介面讓使用者可透過瀏覽器下載,因為是家用私人服務,就不花時間寫權限控管,開放匿名存取。我設計了三個 Action,/files 顯示特定目錄下的結果檔案清單,/download/hashId 可下載檔案,/delete/hashId 則是刪除檔案。Bottle 透過 @route("/action") 定義不同網址的回應行為,@route("/action/") 可從路由取參數。讀檔及刪檔時不使用檔名,而是採取雜湊碼比對,存取範圍嚴格限制在指定目錄內,可降低資安風險。取得檔案清單後轉成 Dictionary,以檔名雜湊碼為 Key,使用白名單方式限定只能下載項目,避免有人在路徑參數動手腳幹壞事。# bottle

bottle's People

Contributors

wmwang avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.