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:
commit
d8a95cee69
2 changed files with 36 additions and 1 deletions
|
|
@ -5,7 +5,7 @@ DiasporaFederation::Engine.routes.draw do
|
||||||
end
|
end
|
||||||
|
|
||||||
controller :fetch do
|
controller :fetch do
|
||||||
get "fetch/:type/:guid" => :fetch, :as => "fetch"
|
get "fetch/:type/:guid" => :fetch, :as => "fetch", :guid => /#{Validation::Rule::Guid::VALID_CHARS}/
|
||||||
end
|
end
|
||||||
|
|
||||||
controller :webfinger do
|
controller :webfinger do
|
||||||
|
|
|
||||||
35
spec/routing/fetch_routing_spec.rb
Normal file
35
spec/routing/fetch_routing_spec.rb
Normal 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
|
||||||
Loading…
Reference in a new issue