generate more normal filenames
This commit is contained in:
parent
d455883369
commit
2d72315584
|
@ -81,8 +81,11 @@ Future<void> _postOnMastodon(reqJson) async {
|
|||
|
||||
final photoUrls = photos.map((photo) {
|
||||
final photoUrl = photo['photo']['sizes'].last['url'];
|
||||
// Generate a random filename.
|
||||
// Add the extension '.jpg'.
|
||||
final photoFilename = '${DateTime.now().millisecondsSinceEpoch}-${photoUrl.split('/').last.split('?').first.substring(0, 10)}.jpg';
|
||||
final photoPath =
|
||||
'${Directory.systemTemp.path}/${photoUrl.split('/').last.split('?').first}';
|
||||
'${Directory.systemTemp.path}/$photoFilename';
|
||||
dio.download(photoUrl, photoPath);
|
||||
return photoPath;
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue