Explorar o código

id is now 12 bytes

encrypt %!s(int64=4) %!d(string=hai) anos
pai
achega
5adb4a07fb
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      server/server.rb

+ 2 - 1
server/server.rb

@@ -5,7 +5,7 @@ require 'json'
 # create a room
 # create a room
 
 
 post '/room' do
 post '/room' do
-  id = SecureRandom.hex(4)
+  id = SecureRandom.hex(6)
   Dir.mkdir(id)
   Dir.mkdir(id)
   content_type 'text/json'
   content_type 'text/json'
   {id: id}.to_json
   {id: id}.to_json
@@ -49,4 +49,5 @@ end
 # remove a file
 # remove a file
 
 
 delete '/room/:id/:filename' do |id, filename|
 delete '/room/:id/:filename' do |id, filename|
+  FileUtils.rm("./"+id+"/"+filename)
 end
 end