From 68845eb7253cd3da14253e004fc1a4fc7eac2e5e Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 8 Nov 2023 22:53:18 +0000 Subject: [PATCH] Use the URL safe base64 variant for mail tokens --- app/models/diary_comment.rb | 2 +- app/models/message.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/diary_comment.rb b/app/models/diary_comment.rb index 8663212eb..55d2c3c84 100644 --- a/app/models/diary_comment.rb +++ b/app/models/diary_comment.rb @@ -42,7 +42,7 @@ class DiaryComment < ApplicationRecord sha256 << Rails.application.key_generator.generate_key("openstreetmap/diary_comment") sha256 << id.to_s sha256 << subscriber.to_s - sha256.base64digest[0, 8] + Base64.urlsafe_encode64(sha256.digest)[0, 8] end private diff --git a/app/models/message.rb b/app/models/message.rb index 0068bc3de..7c12769d3 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -63,6 +63,6 @@ class Message < ApplicationRecord sha256 = Digest::SHA256.new sha256 << Rails.application.key_generator.generate_key("openstreetmap/message") sha256 << id.to_s - sha256.base64digest[0, 8] + Base64.urlsafe_encode64(sha256.digest)[0, 8] end end -- 2.39.5