network-drive 相关问题


如何在PHP中从Google Drive获取文件URL?

我尝试使用 Google Drive API Quickstart.php 并更改了其中的一部分以列出文件 URL。然而它没有用。谁能帮我? 这是我的代码,代码的最后一部分是打印 na...


如何使用 virt-install 在 aarch64 虚拟机上配置显示

我正在运行这个命令: virt-install --virt-type kvm --name oracle --ram 4096 --location=/ssd/OracleLinux-R9-U3-aarch64-dvd.iso --磁盘路径=/ssd/OracleLinux-R9-U3-aarch64 -cloud.qcow2 --network=de...


Hyperledger Fabric 测试网络:$ sudo ./network.sh up(不起作用)

我是超级账本结构的新手,在设置测试网络时遇到错误。 我从 docker-compose github 存储库下载了 Fabric-samples。 然后将目录更改为 test-network。 不...


Google Drive - 使用 Node 通过 JSONClient 进行身份验证

我已成功使用 OAuth2 进行身份验证,现在拥有一个身份验证令牌。 加载此令牌会返回一个 JSONClient: const authClient = google.auth.fromJSON(凭证); 现在正在尝试使用这个


在闪存驱动器中写入文件(仅限Android)

是否可以使用flutter将文件保存到闪存驱动器? 我正在使用带有 USB c 端口的随身碟,如下所示: https://www.bestbuy.com/site/sandisk-ultra-dual-drive-go-1tb-usb-type-a-usb-type-c-flash-


Google App 脚本无法获取 Google Drive 上托管的 CSS 文件(403 未经授权)

我在 Google App 脚本访问 Google 云端硬盘托管资产时遇到问题。奇怪的是,它一直在工作,几天前才停止工作。 发生了什么:在


Google Drive api Python - 上传到文件夹后失去权限

希望有人可以帮助我,因为我正在努力弄清楚为什么会发生这种情况。我有一个文件想要上传到 Google 云端硬盘上的特定文件夹。代码迭代返回的...


为什么我们无法长时间查看 Google Drive 公共文件而不收到 403 禁止错误?

我正在开发一个 Django 项目,我允许用户在具有公共访问权限的谷歌驱动器上上传他们的图像,然后我以用户方式显示所有上传的图像。 一切完成后,我可以创建以下...


如何使用 Microsoft Graph API 解决 Sharepoint(FileContentRead) 中的 404 -“ItemNotFound”错误?

我使用下面的 API 使用 Microsoft Graph API 从 Sharepoint 读取其内容。 https://graph.microsoft.com/v1.0/sites/{主机名},{spsite-id},{spweb-id}/drives//items/ 我使用下面的 API 使用 Microsoft Graph API 从 Sharepoint 读取其内容。 https://graph.microsoft.com/v1.0/sites/{hostname},{spsite-id},{spweb-id}/drives/<drive-id>/items/<items-id>/content 两天前,它正确地从根站点正确获取文件内容。但今天我检查了是否获得了与以下问题相同的文件内容。 { "error": { "code": "itemNotFound", "message": "Item not found", "innerError": { "request-id": "<request_id>", "date": "<date_time>" } } } 不知道这可能是什么原因造成的?我在谷歌上搜索没有找到更好的解决方案。 有人建议我解决上述问题的方法。 我建议使用此端点下载流式 DriveItem 内容: GET /sites/{siteId}/drive/items/{item-id}/content https://learn.microsoft.com/en-us/graph/api/driveitem-get-content?view=graph-rest-1.0&tabs=http


使用 JavaScript 以 HTML 形式显示 Google 云端硬盘中的图像时遇到问题

我正在努力使用 JavaScript 在我的 HTML 页面上显示来自 Google Drive 的图像。遵循在线指南并没有完全解决我的问题。 HTML(索引.html): 我正在努力使用 JavaScript 在我的 HTML 页面上显示来自 Google 云端硬盘的图像。遵循在线指南并没有完全解决我的问题。 HTML(index.html): <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Google Drive Image</title> </head> <body> <img id="imageElement" alt="A lovely image"> <script src="script.js"></script> </body> </html> JavaScript(script.js): const fileId = '1BEW9tkgVKlp_ebUc17LkXDH-mnPc4ome'; const imageElement = document.getElementById('imageElement'); async function fetchGoogleDriveImage(fileId) { try { const response = await fetch(`https://drive.google.com/uc?id=${fileId}`); const url = URL.createObjectURL(await response.blob()); imageElement.src = url; } catch (error) { console.error('Error fetching the image:', error); } } fetchGoogleDriveImage(fileId); 背景: Google 云端硬盘中的图像设置为“知道链接的任何人都可以查看。” 尽管如此,图像仍无法在浏览器中加载,并且控制台显示错误。 附加HTML(纯html): <body> <img src="https://drive.google.com/uc?id=1BEW9tkgVKlp_ebUc17LkXDH-mnPc4ome" alt="Your Image Alt Text"> </body> CodePen 示例 如有任何帮助,我们将不胜感激!谢谢。 虽然没有在任何地方发布(我发现),但 Google Drive 的服务器已开始拒绝附加这两个标头的请求: sec-fetch-mode: no-cors sec-fetch-site: cross-site 如果您将浏览器直接导航到文件的(直接链接)URL(即获取您的src URL并将其粘贴到浏览器导航栏中),但该请求期间的sec-fetch-mode标头将是设置为 navigate 并且效果很好。 但是,与您的 <img> 示例一样,如果请求源是网页,并且与 drive.google.com 来源不同,就会出现问题。 (您的浏览器将自动将这些 sec-fetch-mode 和 sec-fetch-site 标头设置为请求的一部分。) 这似乎是 Google Drive 自 2024 年 1 月 10 日开始的一项未记录的更改,我仍然找不到任何提及它的地方,因此尚不清楚此行为是否会持续存在,或者是否反映了意外更改或疏忽。 我也有同样的问题。临时解决办法是使用大宽度的驱动器文件缩略图 您正在此处执行所有操作,看来问题出在 Google 端,并于今天开始发生(撰写本文时为 2024 年 1 月 11 日)。 Google 可能会解决此问题并允许直接图像嵌入,或者他们可能会继续阻止它,这意味着您必须找到另一种方式来托管网站图像,例如 S3。 (可能)此处跟踪错误:https://issuetracker.google.com/issues/319531488?pli=1 我开始在 HTML 中链接 css 文件时遇到同样的问题。


conda错误ssl证书:HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443

无论我做什么,我都会收到此错误 C:\Users\MyPc>conda update --all 解决环境:失败 CondaHTTPError:URL 的 HTTP 000 连接失败 无论我做什么,我都会收到此错误 C:\Users\MyPc>conda update --all Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/free/win-64/repodata.json.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team. SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/free/win-64/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))')) 我已经搜索了所有互联网,重新安装了 anaconda 并做了建议中的任何操作,但这个问题仍然存在。 Windows 10 C:\Users\MyPc>anaconda --version anaconda 命令行客户端(版本 1.7.2) C:\Users\MyPc>conda --version 康达 4.5.12 就我而言,当我尝试运行此命令时,我收到了此类错误消息 conda install tensorflow 这是错误消息 CondaSSLError:OpenSSL 似乎在此计算机上不可用。下载并安装软件包需要 OpenSSL。 异常:HTTPSConnectionPool(主机='repo.anaconda.com',端口=443):超过最大重试次数,网址:/pkgs/main/win-64/current_repodata.json(由SSLError(“无法连接到HTTPS URL”)引起因为 SSL 模块不可用。")) 这就是解决方案 步骤01 进入你的anaconda3的安装路径 步骤02 现在转到此文件路径 anaconda3\Library\bin 步骤03 现在选择这个 DLL 文件并复制它 libcrypto-1_1-x64.dll libssl-1_1-x64.dll 步骤04 之后转到此文件路径并将其粘贴到该文件夹内部 anaconda3\DLLs 这个命令对我有用: conda config --set ssl_verify false 我也遇到了同样的问题,解决这个问题的方法是安装早期的 32 位版本的 Conda。由于某种原因,较新的 64 位版本似乎容易出现此错误。您可以在这里找到 Conda 的早期版本: https://repo.continuum.io/archive/ 您应该搜索仅具有 x86 而不是 x86_64 的 Anaconda3 版本。 我也遇到了同样的问题,简单的解决方案是: 从开始菜单打开anaconda navigator,然后运行CMD.exe提示符,然后从那里安装,就是这样。 在 C:\Users\xyz 目录中创建一个名为 .condarc 的文件,其中包含以下内容 频道: 默认值 ssl_verify:假 然后尝试创建虚拟环境: conda create -n envname python=x.x anaconda 祝你好运!


为什么现在无法播放 gdrive 文件中的音频?

我有这样的代码: 我有这样的代码: <audio id="player" autoplay controls> <source src="http://docs.google.com/uc?export=open&id=107VpNA7BU4AIxVsK2sRg69-rOigdU57n" type="audio/mp3"> </audio> 最初,上面的代码应该播放驱动器上文件中的歌曲。但是,由于某种原因,它不再起作用了。有人遇到过类似问题吗 听起来您面临着 HTML 的限制,不允许直接从 Google Drive 上的文件流式传输音乐。一种解决方法可能是将音乐文件托管在允许直接流式传输的服务器上,或者您可以考虑使用支持此功能的不同平台或技术。您需要帮助寻找替代解决方案或平台吗? Google 云端硬盘不支持直接流式传输。 您可以尝试使用 Dropbox OP的方法实际上确实适用于从谷歌驱动器传输音频,使用; src="http://docs.google.com/uc?export=open&id=file-id", 直到 2024 年 1 月 10 日左右。 在上述日期之前,我有几个 html/javascript 网络播放器直接从驱动器流式传输我的音乐。 Google 已开始推出影响第三方访问驱动器文件方式的更改;意思是在drive.google.com之外 来自 Google Drive 服务器之外的文件请求不再受到相同的处理。 下面链接中的答案部分解释了问题: https://stackoverflow.com/a/77805668/23238731 虽然这个答案是参考谷歌驱动器中的图像,但这同样适用于像OP代码一样链接的音频文件。 Google 建议用户现在使用 iframe 以 html 形式显示 google 云端硬盘内容,包括音频。 我已经对此进行了测试,iframe 选项确实适用于音频,尽管它对于流媒体没有用。


将 props 传递给 nextjs 中的页面组件

我正在使用 nextjs 的 withlayout 函数为某些页面添加侧边栏。 导出类型 PageWithLayout = NextPage & { withLayout?:(页面:ReactElement)=> 我正在使用 nextjs 的 withlayout 函数为某些页面添加侧边栏。 export type PageWithLayout<P = {}, IP = P> = NextPage<P, IP> & { withLayout?: (page: ReactElement) => ReactNode; }; 这是我的使用方法: export const Interactions: PageWithLayout = () => { const [ getInteractions, { data: interactionData, fetchMore, variables, loading: isInteractionsLoading, error: isInteractionsError, }, ] = useGetInteractionsLazyQuery({ notifyOnNetworkStatusChange: true, fetchPolicy: "network-only", ssr: false, }); return ( <> <Box height={"100vh"}> </Box> </> ); }; Interactions.withLayout = (page: ReactElement) => { // how do I pass isInteractionsLoading as a prop to this component return <Layout>{page}</Layout>; }; export default Interactions; 我想要实现的是将 isInteractionsLoaded 和 isInteractionsError 作为属性传递给我的布局组件,以便我可以渲染这些状态。有没有一种方法可以实现此目的,而无需将布局组件移动到页面组件内? 创建一个包装组件的 React Context 提供程序可能是您使用的解决方案,如果您不想使用任何其他包或不想使用 redux 等更强大的工具,则可以使用。 但是在这里使用有点尴尬,具体取决于包含交互的组件树是什么样子。否则可以根据您的需要使用 _app 入口点。 示例上下文和用法 import React from 'react'; export const InteractionContext = React.createContext({ isInteractionsLoading: false, isInteractionsError: null, }); // parent component or _app if necessary const ProviderComponent = () => { return ( <InteractionContext.Provider value={{ isInteractionsLoading, isInteractionsError }}> <Interactions /> </InteractionContext.Provider> ); }; const Layout = ({ children }) => { const { isInteractionsLoading, isInteractionsError } = useContext(InteractionContext); // Now you can use isInteractionsLoading and isInteractionsError here // ... return <div>{children}</div>; };


通过更少的 Java API 调用来映射 Google 云端硬盘内容的有效方法

大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我做这样的事情: 哈希映射 大家好,我有一个代码,用于列出共享驱动器中存在的文件(以便稍后下载并创建相同的文件夹路径) 目前我正在做这样的事情: HashMap<String, Strin> foldersPathToID = new HashMap<>(); //searching all folders first saving their IDs searchAllFoldersRecursive(folderName.trim(), driveId, foldersPathToID); //then listing files in all folders HashMap<String, List<File>> pathFile = new HashMap<>(); for (Entry<String, String> pathFolder : foldersPathToID.entrySet()) { List<File> result = search(Type.FILE, pathFolder.getValue()); if (result.size() > 0) { String targetPathFolder = pathFolder.getKey().trim(); pathFile.putIfAbsent(targetPathFolder, new ArrayList<>()); for (File file : result) { pathFile.get(targetPathFolder).add(file); } } } 递归方法在哪里: private static void searchAllFoldersRecursive(String nameFold, String id, HashMap<String, String> map) throws IOException, RefreshTokenException { map.putIfAbsent(nameFold, id); List<File> result; result = search(Type.FOLDER, id); // dig deeper if (result.size() > 0) { for (File folder : result) { searchAllFoldersRecursive(nameFold + java.io.File.separator + normalizeName(folder.getName()), folder.getId(), map); } } } 搜索功能是: private static List<com.google.api.services.drive.model.File> search(Type type, String folderId) throws IOException, RefreshTokenException { String nextPageToken = "go"; List<File> driveFolders = new ArrayList<>(); com.google.api.services.drive.Drive.Files.List request = service.files() .list() .setQ("'" + folderId + "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false") .setPageSize(100).setFields("nextPageToken, files(id, name)"); while (nextPageToken != null && nextPageToken.length() > 0) { try { FileList result = request.execute(); driveFolders.addAll(result.getFiles()); nextPageToken = result.getNextPageToken(); request.setPageToken(nextPageToken); return driveFolders; } catch (TokenResponseException tokenError) { if (tokenError.getDetails().getError().equalsIgnoreCase("invalid_grant")) { log.err("Token no more valid removing it Please retry"); java.io.File cred = new java.io.File("./tokens/StoredCredential"); if (cred.exists()) { cred.delete(); } throw new RefreshTokenException("Creds invalid will retry re allow for the token"); } log.err("Error while geting response with token for folder id : " + folderId, tokenError); nextPageToken = null; } catch (Exception e) { log.err("Error while reading folder id : " + folderId, e); nextPageToken = null; } } return new ArrayList<>(); } 我确信有一种方法可以通过很少的 api 调用(甚至可能是一个调用?)对每个文件(使用文件夹树路径)进行正确的映射,因为在我的版本中,我花了很多时间进行调用 service.files().list().setQ("'" + folderId+ "' in parents and mimeType" + (type == Type.FOLDER ? "=" : "!=") + "'application/vnd.google-apps.folder' and trashed = false").setPageSize(100).setFields("nextPageToken, files(id, name)"); 每个子文件夹至少一次......并且递归搜索所有内容需要很长时间。最后,映射比下载本身花费的时间更多...... 我搜索了文档,也在此处搜索,但没有找到任何内容来列出具有一个库的所有驱动器调用任何想法? 我想使用专用的 java API 来获取共享 GoogleDrive 中的所有文件及其相对路径,但调用次数尽可能少。 提前感谢您的时间和答复 我建议您使用高效的数据结构和逻辑来构建文件夹树并将文件映射到其路径,如下所示 private static void mapDriveContent(String driveId) throws IOException { // HashMap to store folder ID to path mapping HashMap<String, String> idToPath = new HashMap<>(); // HashMap to store files based on their paths HashMap<String, List<File>> pathToFile = new HashMap<>(); // Fetch all files and folders in the drive List<File> allFiles = fetchAllFiles(driveId); // Build folder path mapping and organize files for (File file : allFiles) { String parentId = (file.getParents() != null && !file.getParents().isEmpty()) ? file.getParents().get(0) : null; String path = buildPath(file, parentId, idToPath); if (file.getMimeType().equals("application/vnd.google-apps.folder")) { idToPath.put(file.getId(), path); } else { pathToFile.computeIfAbsent(path, k -> new ArrayList<>()).add(file); } } // Now, pathToFile contains the mapping of paths to files // Your logic to handle these files goes here } private static List<File> fetchAllFiles(String driveId) throws IOException { // Implement fetching all files and folders here // Make sure to handle pagination if necessary // ... } private static String buildPath(File file, String parentId, HashMap<String, String> idToPath) { // Build the file path based on its parent ID and the idToPath mapping // ... }


© www.soinside.com 2019 - 2024. All rights reserved.