We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
attachments are stored in hashed format in the trac data dir now. maybe make this a switch.
diff --git a/trac-hub b/trac-hub index daece2b..657260a 100755 --- a/trac-hub +++ b/trac-hub @@ -9,6 +9,8 @@ require 'yaml' require 'set' require 'singleton' require 'uri' +require 'digest/sha1' + class GracefulQuit include Singleton @@ -341,7 +343,19 @@ class Migrator when 'attachment' text = "**Attachment added:**" if @attachurl - url="#{@attachurl}/#{i}/#{ticket[:filename]}" + #hashed URLs. + #ticket 14/blahblah.java is in + # `fa3/fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b/d8be6619342d0340df06a23e8a9f2b720ac32bc8.java` + # <first 3 of # hash>/<full # hash>/<filename hash>.<extension> + hash_dir = Digest::SHA1.hexdigest("#{i}") # 14 -> fa35e192121eabf3dabf9f5ea6abdbcbc107ac3b + hash_par = hash_dir[0,3] # 14 -> fa3 + hash_file = Digest::SHA1.hexdigest("#{ticket[:filename]}") # -> d8be6619342d0340df06a23e8a9f2b720ac32bc8 + file_suff = File.extname(ticket[:filename]) + url="#{@attachurl}/#{hash_par}/#{hash_dir}/#{hash_file}#{file_suff}" + + # OTHER WAY (non hashed) + #url="#{@attachurl}/#{i}/#{ticket[:filename]}" + if [".png", ".jpg", ".gif", ".PNG", ".JPG", ".GIF"].include? File.extname(ticket[:filename]) text = "#{text} `#{ticket[:filename]}` (#{(ticket[:size]/1024.0).round(1)} KiB)\n![#{ticket[:filename]}](#{URI.escape(url)})"
The text was updated successfully, but these errors were encountered:
In general, this looks good to me. Have you tested this successfully? I'm happy to merge a PR with this patch if you greenlight it.
Sorry, something went wrong.
Yes, for an import of about a thousand issues. Worked great, may be behind some sort of switch.
Enviado desde nuestro iPhone.
El ago 29, 2016, a las 10:44 AM, Matthias Vallentin notifications@github.com escribió: In general, this looks good to me. Have you tested this successfully? I'm happy to merge PR with this patch if you greenlight it. — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
El ago 29, 2016, a las 10:44 AM, Matthias Vallentin notifications@github.com escribió:
In general, this looks good to me. Have you tested this successfully? I'm happy to merge PR with this patch if you greenlight it.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
No branches or pull requests
attachments are stored in hashed format in the trac data dir now. maybe make this a switch.
The text was updated successfully, but these errors were encountered: