Fix download link permissions

This commit is contained in:
Nexus 2023-08-16 19:23:45 +01:00
parent 088d31825b
commit 47f9019fa6
Signed by: nex
GPG key ID: 0FA334385D0B689F

View file

@ -1700,9 +1700,10 @@ class OtherCog(commands.Cog):
output_location = Path(output_file.name) output_location = Path(output_file.name)
stat = output_location.stat() stat = output_location.stat()
content = ("\N{white heavy check mark} Transcoded from %r to opus @ %dkbps.\n" content = ("\N{white heavy check mark} Transcoded from %r to opus @ %dkbps.\n\n"
"* Source: %dKbps\n* Target: %dKbps\n* Ceiling: %dKbps\n* Calculated: %dKbps\n" "* Source: %dKbps\n* Target: %dKbps\n* Ceiling: %dKbps\n* Calculated: %dKbps\n"
"* Duration: %.1f seconds\n* Input size: %s\n* Output size: %s") % ( "* Duration: %.1f seconds\n* Input size: %s\n* Output size: %s\n* Difference: %s"
" (%dKbps)") % (
codec, codec,
end_br, end_br,
bit_rate, bit_rate,
@ -1711,7 +1712,8 @@ class OtherCog(commands.Cog):
end_br, end_br,
duration, duration,
humanise(file.size), humanise(file.size),
humanise(stat.st_size) humanise(stat.st_size),
humanise(file.size - stat.st_size, )
) )
if stat.st_size <= max_size or share is False: if stat.st_size <= max_size or share is False:
if stat.st_size >= (size_bytes - 100): if stat.st_size >= (size_bytes - 100):
@ -1723,12 +1725,14 @@ class OtherCog(commands.Cog):
file=discord.File(output_location) file=discord.File(output_location)
) )
else: else:
share_location = Path("/mnt/vol/share/tmp/") / output_location.name
share_location.touch(0o755)
await self.bot.loop.run_in_executor( await self.bot.loop.run_in_executor(
None, None,
functools.partial( functools.partial(
shutil.copy, shutil.copy,
output_location, output_location,
"/mnt/vol/share/tmp/" + output_location.name share_location
) )
) )
return await ctx.respond( return await ctx.respond(