{"action":"opened","issue":{"url":"https://api.github.com/repos/mavam/trac-hub/issues/8","repository_url":"https://api.github.com/repos/mavam/trac-hub","labels_url":"https://api.github.com/repos/mavam/trac-hub/issues/8/labels{/name}","comments_url":"https://api.github.com/repos/mavam/trac-hub/issues/8/comments","events_url":"https://api.github.com/repos/mavam/trac-hub/issues/8/events","html_url":"https://github.com/mavam/trac-hub/issues/8","id":173092224,"number":8,"title":"support hashed attachments","user":{"login":"srl295","id":855219,"avatar_url":"https://avatars.githubusercontent.com/u/855219?v=3","gravatar_id":"","url":"https://api.github.com/users/srl295","html_url":"https://github.com/srl295","followers_url":"https://api.github.com/users/srl295/followers","following_url":"https://api.github.com/users/srl295/following{/other_user}","gists_url":"https://api.github.com/users/srl295/gists{/gist_id}","starred_url":"https://api.github.com/users/srl295/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/srl295/subscriptions","organizations_url":"https://api.github.com/users/srl295/orgs","repos_url":"https://api.github.com/users/srl295/repos","events_url":"https://api.github.com/users/srl295/events{/privacy}","received_events_url":"https://api.github.com/users/srl295/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-25T01:01:56Z","updated_at":"2016-08-25T01:01:56Z","closed_at":null,"body":"attachments are stored in hashed format in the trac data dir now. maybe make this a switch.\r\n\r\n```\r\ndiff --git a/trac-hub b/trac-hub\r\nindex daece2b..657260a 100755\r\n--- a/trac-hub\r\n+++ b/trac-hub\r\n@@ -9,6 +9,8 @@ require 'yaml'\r\n require 'set'\r\n require 'singleton'\r\n require 'uri'\r\n+require 'digest/sha1'\r\n+\r\n \r\n class GracefulQuit\r\n   include Singleton\r\n@@ -341,7 +343,19 @@ class Migrator\r\n           when 'attachment'\r\n             text = \"**Attachment added:**\"\r\n             if @attachurl\r\n-              url=\"#{@attachurl}/#{i}/#{ticket[:filename]}\"\r\n+              #hashed URLs.   \r\n+              #ticket 14/blahblah.java is in \r\n+              #  `fa3/fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b/d8be6619342d0340df06a23e8a9f2b720ac32bc8.java`\r\n+              #  <first 3 of # hash>/<full # hash>/<filename hash>.<extension>\r\n+              hash_dir = Digest::SHA1.hexdigest(\"#{i}\")  # 14 -> fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b\r\n+              hash_par = hash_dir[0,3] # 14 -> fa3\r\n+              hash_file = Digest::SHA1.hexdigest(\"#{ticket[:filename]}\") # -> d8be6619342d0340df06a23e8a9f2b720ac32bc8\r\n+              file_suff = File.extname(ticket[:filename])\r\n+              url=\"#{@attachurl}/#{hash_par}/#{hash_dir}/#{hash_file}#{file_suff}\"\r\n+\r\n+              # OTHER WAY (non hashed)\r\n+              #url=\"#{@attachurl}/#{i}/#{ticket[:filename]}\"\r\n+\r\n               if [\".png\", \".jpg\", \".gif\", \".PNG\", \".JPG\", \".GIF\"].include? File.extname(ticket[:filename])\r\n                 text = \"#{text} `#{ticket[:filename]}` (#{(ticket[:size]/1024.0).round(1)} KiB)\\n![#{ticket[:filename]}](#{URI.escape(url)})\"\r\n```\r\n"}}
{"actor":{"display_login":"srl295"}}