File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed
Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change @@ -170,23 +170,16 @@ private function post($url, $body)
170170 public static function createTimestampAntiLeechUrl ($ rawUrl , $ encryptKey , $ durationInSeconds )
171171 {
172172 $ parsedUrl = parse_url ($ rawUrl );
173-
174173 $ deadline = time () + $ durationInSeconds ;
175174 $ expireHex = dechex ($ deadline );
176-
177175 $ path = isset ($ parsedUrl ['path ' ]) ? $ parsedUrl ['path ' ] : '' ;
178- $ path = implode ('/ ' , array_map ('rawurlencode ' , explode ('/ ' , $ path )));
179176 $ strToSign = $ encryptKey . $ path . $ expireHex ;
180177 $ signStr = md5 ($ strToSign );
181-
182- $ url = $ parsedUrl ['scheme ' ].':// ' .$ parsedUrl ['host ' ].$ path ;
183-
184178 if (isset ($ parsedUrl ['query ' ])) {
185- $ signedUrl = $ url . '&sign= ' . $ signStr . '&t= ' . $ expireHex ;
179+ $ signedUrl = $ rawUrl . '&sign= ' . $ signStr . '&t= ' . $ expireHex ;
186180 } else {
187- $ signedUrl = $ url . '?sign= ' . $ signStr . '&t= ' . $ expireHex ;
181+ $ signedUrl = $ rawUrl . '?sign= ' . $ signStr . '&t= ' . $ expireHex ;
188182 }
189-
190183 return $ signedUrl ;
191184 }
192185}
You can’t perform that action at this time.
0 commit comments