Merge pull request #106 from SuperTux88/fix-fetching-with-dots-in-guids

Allow fetching of posts with dot in the GUID
This commit is contained in:
Benjamin Neff 2018-10-05 21:46:14 +02:00
commit d8a95cee69
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 36 additions and 1 deletions

View file

@ -5,7 +5,7 @@ DiasporaFederation::Engine.routes.draw do
end
controller :fetch do
get "fetch/:type/:guid" => :fetch, :as => "fetch"
get "fetch/:type/:guid" => :fetch, :as => "fetch", :guid => /#{Validation::Rule::Guid::VALID_CHARS}/
end
controller :webfinger do

View file

@ -0,0 +1,35 @@
module DiasporaFederation
describe ReceiveController, type: :routing do
routes { DiasporaFederation::Engine.routes }
let(:guid) { "12345678901234567890abcdefgh" }
it "routes post fetch" do
expect(get: "/fetch/post/#{guid}").to route_to(
controller: "diaspora_federation/fetch",
action: "fetch",
type: "post",
guid: guid
)
end
it "routes post fetch" do
expect(get: "/fetch/status_message/#{guid}").to route_to(
controller: "diaspora_federation/fetch",
action: "fetch",
type: "status_message",
guid: guid
)
end
it "routes post fetch with GUID with dots (hubzilla)" do
guid = "1234567890abcd@hubzilla.example.org"
expect(get: "/fetch/post/#{guid}").to route_to(
controller: "diaspora_federation/fetch",
action: "fetch",
type: "post",
guid: guid
)
end
end
end