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 photoUrls = photos.map((photo) {
|
||||||
final photoUrl = photo['photo']['sizes'].last['url'];
|
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 =
|
final photoPath =
|
||||||
'${Directory.systemTemp.path}/${photoUrl.split('/').last.split('?').first}';
|
'${Directory.systemTemp.path}/$photoFilename';
|
||||||
dio.download(photoUrl, photoPath);
|
dio.download(photoUrl, photoPath);
|
||||||
return photoPath;
|
return photoPath;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue